idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
36,300 | public function update ( $ id , array $ params ) { $ defaults = [ 'id' => $ id , 'name' => null , 'identifier' => null , 'description' => null , ] ; $ params = $ this -> sanitizeParams ( $ defaults , $ params ) ; $ xml = $ this -> prepareParamsXml ( $ params ) ; return $ this -> put ( '/projects/' . $ id . '.xml' , $ x... | Update project s information . |
36,301 | public static function register ( Shell $ shell , $ classMapPath ) { return tap ( new static ( $ shell , $ classMapPath ) , function ( $ loader ) { spl_autoload_register ( [ $ loader , 'aliasClass' ] ) ; } ) ; } | Register a new alias loader instance . |
36,302 | public function aliasClass ( $ class ) { if ( Str :: contains ( $ class , '\\' ) ) { return ; } $ fullName = isset ( $ this -> classes [ $ class ] ) ? $ this -> classes [ $ class ] : false ; if ( $ fullName ) { $ this -> shell -> writeStdout ( "[!] Aliasing '{$class}' to '{$fullName}' for this Tinker session.\n" ) ; cl... | Find the closest class by name . |
36,303 | protected function getCommands ( ) { $ commands = [ ] ; foreach ( $ this -> getApplication ( ) -> all ( ) as $ name => $ command ) { if ( in_array ( $ name , $ this -> commandWhitelist ) ) { $ commands [ ] = $ command ; } } foreach ( config ( 'tinker.commands' , [ ] ) as $ command ) { $ commands [ ] = $ this -> getAppl... | Get artisan commands to pass through to PsySH . |
36,304 | public static function register ( array $ directives ) { collect ( $ directives ) -> each ( function ( $ item , $ key ) { Blade :: directive ( $ key , $ item ) ; } ) ; } | Register the directives . |
36,305 | public function inlineCssOnElement ( \ DOMElement $ element , array $ properties ) { if ( empty ( $ properties ) ) { return $ element ; } $ cssProperties = array ( ) ; $ inlineProperties = array ( ) ; foreach ( $ this -> getInlineStyles ( $ element ) as $ property ) { $ inlineProperties [ $ property -> getName ( ) ] = ... | Inline the given properties on an given DOMElement |
36,306 | public function getInlineStyles ( \ DOMElement $ element ) { $ processor = new PropertyProcessor ( ) ; return $ processor -> convertArrayToObjects ( $ processor -> splitIntoSeparateProperties ( $ element -> getAttribute ( 'style' ) ) ) ; } | Get the current inline styles for a given DOMElement |
36,307 | private function calculatePropertiesToBeApplied ( array $ properties , array $ cssProperties ) { if ( empty ( $ properties ) ) { return $ cssProperties ; } foreach ( $ properties as $ property ) { if ( isset ( $ cssProperties [ $ property -> getName ( ) ] ) ) { $ existingProperty = $ cssProperties [ $ property -> getNa... | Merge the CSS rules to determine the applied properties . |
36,308 | public static function sortOnSpecificity ( Rule $ e1 , Rule $ e2 ) { $ e1Specificity = $ e1 -> getSpecificity ( ) ; $ value = $ e1Specificity -> compareTo ( $ e2 -> getSpecificity ( ) ) ; if ( $ value === 0 ) { $ value = $ e1 -> getOrder ( ) - $ e2 -> getOrder ( ) ; } return $ value ; } | Sort an array on the specificity element in an ascending way Lower specificity will be sorted to the beginning of the array |
36,309 | public function splitIntoSeparateProperties ( $ propertiesString ) { $ propertiesString = $ this -> cleanup ( $ propertiesString ) ; $ properties = ( array ) explode ( ';' , $ propertiesString ) ; $ keysToRemove = array ( ) ; $ numberOfProperties = count ( $ properties ) ; for ( $ i = 0 ; $ i < $ numberOfProperties ; $... | Split a string into seperate properties |
36,310 | public function convertToObject ( $ property , Specificity $ specificity = null ) { if ( strpos ( $ property , ':' ) === false ) { return null ; } list ( $ name , $ value ) = explode ( ':' , $ property , 2 ) ; $ name = trim ( $ name ) ; $ value = trim ( $ value ) ; if ( $ value === '' ) { return null ; } return new Pro... | Convert a property - string into an object |
36,311 | public function convertArrayToObjects ( array $ properties , Specificity $ specificity = null ) { $ objects = array ( ) ; foreach ( $ properties as $ property ) { $ object = $ this -> convertToObject ( $ property , $ specificity ) ; if ( $ object === null ) { continue ; } $ objects [ ] = $ object ; } return $ objects ;... | Convert an array of property - strings into objects |
36,312 | public function buildPropertiesString ( array $ properties ) { $ chunks = array ( ) ; foreach ( $ properties as $ property ) { $ chunks [ ] = $ property -> toString ( ) ; } return implode ( ' ' , $ chunks ) ; } | Build the property - string for multiple properties |
36,313 | public function build ( ) { $ this -> useAutowiring ( false ) ; $ this -> useAnnotations ( false ) ; $ container = parent :: build ( ) ; $ container -> call ( [ $ this -> annReader , 'setLoader' ] ) ; return $ container ; } | Build and return a container . |
36,314 | private function getParametersDefinition ( \ ReflectionFunctionAbstract $ constructor ) { $ parameters = [ ] ; foreach ( $ constructor -> getParameters ( ) as $ index => $ parameter ) { if ( $ parameter -> isOptional ( ) ) { continue ; } $ parameterClass = $ parameter -> getClass ( ) ; if ( $ parameterClass ) { $ param... | Read the type - hinting from the parameters of the function . |
36,315 | public function loadRoutesFromClass ( $ className , $ hooks = [ ] ) { $ cache = new CheckableCache ( $ this -> cache ) ; $ key = 'loadRoutesFromClass:' . md5 ( __CLASS__ . ':' . $ className ) ; $ routes = $ cache -> get ( $ key , $ this ) ; $ controller = null ; if ( $ routes == $ this ) { $ routes = [ ] ; $ controller... | load routes from class |
36,316 | public function loadRoutesFromPath ( $ fromPath , $ namespace = '' , $ hooks = [ ] ) { $ dir = @ dir ( $ fromPath ) or abort ( "dir $fromPath not exist" ) ; $ getEach = function ( ) use ( $ dir ) { $ name = $ dir -> read ( ) ; if ( ! $ name ) { return $ name ; } return $ name ; } ; while ( ! ! ( $ entry = $ getEach ( )... | load routes from path |
36,317 | public function build ( $ className ) { $ rfl = new \ ReflectionClass ( $ className ) or \ PhpBoot \ abort ( "load class $className failed" ) ; $ fileName = $ rfl -> getFileName ( ) ; $ key = str_replace ( '\\' , '.' , get_class ( $ this ) ) . md5 ( serialize ( $ this -> annotations ) . $ fileName . $ className ) ; $ c... | load from class with local cache |
36,318 | static public function register ( Application $ app , callable $ callback = null , $ prefix = '/docs' ) { $ app -> addRoute ( 'GET' , $ prefix . '/swagger.json' , function ( Application $ app ) use ( $ callback ) { $ swagger = new Swagger ( ) ; $ swagger -> appendControllers ( $ app , $ app -> getControllers ( ) ) ; if... | How to use |
36,319 | static public function connect ( Application $ app , $ dsn , $ username , $ password , $ options = [ ] ) { $ options += [ \ PDO :: ATTR_ERRMODE => \ PDO :: ERRMODE_EXCEPTION , \ PDO :: MYSQL_ATTR_INIT_COMMAND => "SET NAMES'utf8';" , \ PDO :: MYSQL_ATTR_FOUND_ROWS => true ] ; $ connection = new \ PDO ( $ dsn , $ usernam... | DB constructor . |
36,320 | public function getFirst ( ) { $ res = ExecImpl :: get ( $ this -> context ) ; if ( count ( $ res ) ) { return $ res [ 0 ] ; } return null ; } | Execute sql and get one response |
36,321 | public static function resolve ( ) : Application { $ app = ( new self ) -> createApplication ( ) ; $ composerFile = getcwd ( ) . DIRECTORY_SEPARATOR . 'composer.json' ; if ( file_exists ( $ composerFile ) ) { $ namespace = ( string ) key ( json_decode ( ( string ) file_get_contents ( $ composerFile ) , true ) [ 'autolo... | Creates an application and registers service providers found . |
36,322 | private function isContainer ( Type $ type ) : bool { foreach ( $ type -> getReferencedClasses ( ) as $ referencedClass ) { $ isClassOrInterface = class_exists ( $ referencedClass ) || interface_exists ( $ referencedClass ) ; if ( $ isClassOrInterface && ( new ReflectionClass ( $ referencedClass ) ) -> implementsInterf... | Checks if the provided type implements the Illuminate Container Contract . |
36,323 | private function defaultConfiguration ( ) : string { $ supportedFiles = [ 'larastan.neon' , 'phpstan.neon' , 'phpstan.neon.dist' , ] ; foreach ( $ supportedFiles as $ file ) { $ filePath = base_path ( $ file ) ; if ( file_exists ( $ filePath ) ) { return $ filePath ; } } return __DIR__ . '/../../extension.neon' ; } | Determines the default configuration . |
36,324 | private function replaceStaticType ( array $ types , string $ staticType ) : array { $ mixins = array_merge ( [ Model :: class ] , $ this -> mixins -> getMixinsFromClass ( $ this -> broker , $ this -> broker -> getClass ( Model :: class ) ) ) ; foreach ( $ types as $ key => $ type ) { if ( $ type instanceof ObjectType ... | Replaces Static Types by the provided Static Type . |
36,325 | protected function checkBrowsers ( ) { return ( $ this -> checkBrowserWebTv ( ) || $ this -> checkBrowserEdge ( ) || $ this -> checkBrowserInternetExplorer ( ) || $ this -> checkBrowserOpera ( ) || $ this -> checkBrowserGaleon ( ) || $ this -> checkBrowserNetscapeNavigator9Plus ( ) || $ this -> checkBrowserVivaldi ( ) ... | Protected routine to determine the browser type |
36,326 | protected function checkBrowserYandexBot ( ) { if ( stripos ( $ this -> _agent , 'YandexBot' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YandexBot' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( str_replace ( ';' , '' , $ av... | Determine if the browser is the YandexBot or not |
36,327 | protected function checkBrowserYandexImageResizerBot ( ) { if ( stripos ( $ this -> _agent , 'YandexImageResizer' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YandexImageResizer' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion (... | Determine if the browser is the YandexImageResizer or not |
36,328 | protected function checkBrowserYandexCatalogBot ( ) { if ( stripos ( $ this -> _agent , 'YandexCatalog' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YandexCatalog' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( str_replace ( ... | Determine if the browser is the YandexCatalog or not |
36,329 | protected function checkBrowserYandexNewsBot ( ) { if ( stripos ( $ this -> _agent , 'YandexNews' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YandexNews' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( str_replace ( ';' , '' ... | Determine if the browser is the YandexNews or not |
36,330 | protected function checkBrowserYandexMetrikaBot ( ) { if ( stripos ( $ this -> _agent , 'YandexMetrika' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YandexMetrika' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( str_replace ( ... | Determine if the browser is the YandexMetrika or not |
36,331 | protected function checkBrowserYandexDirectBot ( ) { if ( stripos ( $ this -> _agent , 'YandexDirect' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YandexDirect' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( str_replace ( ';'... | Determine if the browser is the YandexDirect or not |
36,332 | protected function checkBrowserYandexWebmasterBot ( ) { if ( stripos ( $ this -> _agent , 'YandexWebmaster' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YandexWebmaster' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( str_repl... | Determine if the browser is the YandexWebmaster or not |
36,333 | protected function checkBrowserYandexFaviconsBot ( ) { if ( stripos ( $ this -> _agent , 'YandexFavicons' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YandexFavicons' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( str_replace... | Determine if the browser is the YandexFavicons or not |
36,334 | protected function checkBrowserYandexBlogsBot ( ) { if ( stripos ( $ this -> _agent , 'YandexBlogs' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YandexBlogs' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( str_replace ( ';' , ... | Determine if the browser is the YandexBlogs or not |
36,335 | protected function checkBrowserYandexMediaBot ( ) { if ( stripos ( $ this -> _agent , 'YandexMedia' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YandexMedia' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( str_replace ( ';' , ... | Determine if the browser is the YandexMedia or not |
36,336 | protected function checkBrowserYandexVideoBot ( ) { if ( stripos ( $ this -> _agent , 'YandexVideo' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YandexVideo' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( str_replace ( ';' , ... | Determine if the browser is the YandexVideo or not |
36,337 | protected function checkBrowserYandexImagesBot ( ) { if ( stripos ( $ this -> _agent , 'YandexImages' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YandexImages' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( str_replace ( ';'... | Determine if the browser is the YandexImages or not |
36,338 | protected function checkBrowserEdge ( ) { if ( stripos ( $ this -> _agent , 'Edge/' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'Edge' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( $ aversion [ 0 ] ) ; $ this -> setBrowser (... | Determine if the browser is Edge or not |
36,339 | protected function checkFacebookExternalHit ( ) { if ( stristr ( $ this -> _agent , 'FacebookExternalHit' ) ) { $ this -> setRobot ( true ) ; $ this -> setFacebook ( true ) ; return true ; } return false ; } | Detect if URL is loaded from FacebookExternalHit |
36,340 | protected function getSafariVersionOnIos ( ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'Version' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( $ aversion [ 0 ] ) ; return true ; } return false ; } | Detect Version for the Safari browser on iOS devices |
36,341 | protected function getChromeVersionOnIos ( ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'CriOS' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( $ aversion [ 0 ] ) ; $ this -> setBrowser ( self :: BROWSER_CHROME ) ; return true ; } return f... | Detect Version for the Chrome browser on iOS devices |
36,342 | protected function checkBrowserYandex ( ) { if ( stripos ( $ this -> _agent , 'YaBrowser' ) !== false ) { $ aresult = explode ( '/' , stristr ( $ this -> _agent , 'YaBrowser' ) ) ; if ( isset ( $ aresult [ 1 ] ) ) { $ aversion = explode ( ' ' , $ aresult [ 1 ] ) ; $ this -> setVersion ( $ aversion [ 0 ] ) ; $ this -> s... | Determine if the browser is Yandex |
36,343 | protected function checkBrowserPlayStation ( ) { if ( stripos ( $ this -> _agent , 'PlayStation ' ) !== false ) { $ aresult = explode ( ' ' , stristr ( $ this -> _agent , 'PlayStation ' ) ) ; $ this -> setBrowser ( self :: BROWSER_PLAYSTATION ) ; if ( isset ( $ aresult [ 0 ] ) ) { $ aversion = explode ( ')' , $ aresult... | Determine if the browser is a PlayStation |
36,344 | public function transform ( $ value ) { if ( $ value instanceof JsonSerializable || $ value instanceof StdClass ) { return json_encode ( $ value ) ; } if ( method_exists ( $ value , 'toJson' ) ) { return $ value ; } if ( ! method_exists ( $ value , '__toString' ) ) { throw new \ Exception ( 'Cannot transform this objec... | Transform an object to JS . |
36,345 | public function boot ( ) { $ this -> publishes ( [ __DIR__ . '/config/javascript.php' => config_path ( 'javascript.php' ) ] ) ; if ( class_exists ( 'Illuminate\Foundation\AliasLoader' ) ) { AliasLoader :: getInstance ( ) -> alias ( 'JavaScript' , 'Laracasts\Utilities\JavaScript\JavaScriptFacade' ) ; } else { class_alia... | Publish the plugin configuration . |
36,346 | public function constructJavaScript ( $ variables ) { return $ this -> constructNamespace ( ) . collect ( $ variables ) -> map ( function ( $ value , $ name ) { return $ this -> initializeVariable ( $ name , $ value ) ; } ) -> implode ( '' ) ; } | Translate the array of PHP variables to a JavaScript syntax . |
36,347 | protected function normalizeInput ( $ arguments ) { if ( is_array ( $ arguments [ 0 ] ) ) { return $ arguments [ 0 ] ; } if ( count ( $ arguments ) == 2 ) { return [ $ arguments [ 0 ] => $ arguments [ 1 ] ] ; } throw new Exception ( 'Try JavaScript::put(["foo" => "bar"])' ) ; } | Normalize the input arguments . |
36,348 | public function bind ( $ js ) { foreach ( $ this -> views as $ view ) { $ this -> event -> listen ( "composing: {$view}" , function ( ) use ( $ js ) { echo "<script>{$js}</script>" ; } ) ; } } | Bind the given JavaScript to the view . |
36,349 | private function setUser2StepData ( ) { $ user = Auth :: User ( ) ; $ twoStepAuth = $ this -> getTwoStepAuthStatus ( $ user -> id ) ; $ authCount = $ twoStepAuth -> authCount ; $ this -> _user = $ user ; $ this -> _twoStepAuth = $ twoStepAuth ; $ this -> _authCount = $ authCount ; $ this -> _authStatus = $ twoStepAuth ... | Set the User2Step Variables . |
36,350 | private function invalidCodeReturnData ( $ errors = null ) { $ this -> _authCount = $ this -> _twoStepAuth -> authCount += 1 ; $ this -> _twoStepAuth -> save ( ) ; $ returnData = [ 'message' => trans ( 'laravel2step::laravel-verification.titleFailed' ) , 'authCount' => $ this -> _authCount , 'remainingAttempts' => $ th... | Validation and Invalid code failed actions and return message . |
36,351 | public function showVerification ( ) { if ( ! config ( 'laravel2step.laravel2stepEnabled' ) ) { abort ( 404 ) ; } $ twoStepAuth = $ this -> _twoStepAuth ; $ authStatus = $ this -> _authStatus ; if ( $ this -> checkExceededTime ( $ twoStepAuth -> updated_at ) ) { $ this -> resetExceededTime ( $ twoStepAuth ) ; } $ data ... | Show the twostep verification form . |
36,352 | public function verify ( Request $ request ) { if ( ! config ( 'laravel2step.laravel2stepEnabled' ) ) { abort ( 404 ) ; } if ( $ request -> ajax ( ) ) { $ validator = Validator :: make ( $ request -> all ( ) , [ 'v_input_1' => 'required|min:1|max:1' , 'v_input_2' => 'required|min:1|max:1' , 'v_input_3' => 'required|min... | Verify the user code input . |
36,353 | public function resend ( ) { if ( ! config ( 'laravel2step.laravel2stepEnabled' ) ) { abort ( 404 ) ; } $ twoStepAuth = $ this -> _twoStepAuth ; $ this -> sendVerificationCodeNotification ( $ twoStepAuth ) ; $ returnData = [ 'title' => trans ( 'laravel2step::laravel-verification.verificationEmailSuccess' ) , 'message' ... | Resend the validation code triggered by user . |
36,354 | public function twoStepVerification ( $ request ) { $ user = Auth :: User ( ) ; if ( $ user ) { $ twoStepAuthStatus = $ this -> checkTwoStepAuthStatus ( $ user -> id ) ; if ( $ twoStepAuthStatus -> authStatus !== true ) { return false ; } else { if ( $ this -> checkTimeSinceVerified ( $ twoStepAuthStatus ) ) { return f... | Check if the user is authorized . |
36,355 | private function checkTimeSinceVerified ( $ twoStepAuth ) { $ expireMinutes = config ( 'laravel2step.laravel2stepVerifiedLifetimeMinutes' ) ; $ now = Carbon :: now ( ) ; $ expire = Carbon :: parse ( $ twoStepAuth -> authDate ) -> addMinutes ( $ expireMinutes ) ; $ expired = $ now -> gt ( $ expire ) ; if ( $ expired ) {... | Check time since user was last verified and take apprpriate action . |
36,356 | private function resetAuthStatus ( $ twoStepAuth ) { $ twoStepAuth -> authCode = $ this -> generateCode ( ) ; $ twoStepAuth -> authCount = 0 ; $ twoStepAuth -> authStatus = 0 ; $ twoStepAuth -> authDate = null ; $ twoStepAuth -> requestDate = null ; $ twoStepAuth -> save ( ) ; return $ twoStepAuth ; } | Reset TwoStepAuth collection item and code . |
36,357 | private function generateCode ( int $ length = 4 , string $ prefix = '' , string $ suffix = '' ) { for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ prefix .= random_int ( 0 , 1 ) ? chr ( random_int ( 65 , 90 ) ) : random_int ( 0 , 9 ) ; } return $ prefix . $ suffix ; } | Generate Authorization Code . |
36,358 | protected function exceededTimeParser ( $ time ) { $ tomorrow = Carbon :: parse ( $ time ) -> addMinutes ( config ( 'laravel2step.laravel2stepExceededCountdownMinutes' ) ) -> format ( 'l, F jS Y h:i:sa' ) ; $ remaining = $ time -> addMinutes ( config ( 'laravel2step.laravel2stepExceededCountdownMinutes' ) ) -> diffForH... | Format verification exceeded timings with Carbon . |
36,359 | protected function checkExceededTime ( $ time ) { $ now = Carbon :: now ( ) ; $ expire = Carbon :: parse ( $ time ) -> addMinutes ( config ( 'laravel2step.laravel2stepExceededCountdownMinutes' ) ) ; $ expired = $ now -> gt ( $ expire ) ; if ( $ expired ) { return true ; } return false ; } | Check if time since account lock has expired and return true if account verification can be reset . |
36,360 | protected function resetExceededTime ( $ twoStepEntry ) { $ twoStepEntry -> authCount = 0 ; $ twoStepEntry -> authCode = $ this -> generateCode ( ) ; $ twoStepEntry -> save ( ) ; return $ twoStepEntry ; } | Method to reset code and count . |
36,361 | protected function resetActivationCountdown ( $ twoStepAuth ) { $ twoStepAuth -> authCode = $ this -> generateCode ( ) ; $ twoStepAuth -> authCount = 0 ; $ twoStepAuth -> authStatus = 1 ; $ twoStepAuth -> authDate = Carbon :: now ( ) ; $ twoStepAuth -> requestDate = null ; $ twoStepAuth -> save ( ) ; } | Successful activation actions . |
36,362 | protected function sendVerificationCodeNotification ( $ twoStepAuth , $ deliveryMethod = null ) { $ user = Auth :: User ( ) ; if ( $ deliveryMethod === null ) { $ user -> notify ( new SendVerificationCodeEmail ( $ user , $ twoStepAuth -> authCode ) ) ; } $ twoStepAuth -> requestDate = Carbon :: now ( ) ; $ twoStepAuth ... | Send verification code via notify . |
36,363 | private function publishFiles ( ) { $ publishTag = 'laravel2step' ; $ this -> publishes ( [ __DIR__ . '/config/laravel2step.php' => base_path ( 'config/laravel2step.php' ) , ] , $ publishTag ) ; $ this -> publishes ( [ __DIR__ . '/database/migrations/' => base_path ( '/database/migrations' ) , ] , $ publishTag ) ; $ th... | Publish files for Laravel 2 - Step Verification . |
36,364 | public function generateToken ( string $ source , string $ target , string $ text ) : string { return $ this -> TL ( $ text ) ; } | Generate and return a token . |
36,365 | private function JS_charCodeAt ( $ str , $ index ) { $ utf16 = mb_convert_encoding ( $ str , 'UTF-16LE' , 'UTF-8' ) ; return ord ( $ utf16 [ $ index * 2 ] ) + ( ord ( $ utf16 [ $ index * 2 + 1 ] ) << 8 ) ; } | Get JS charCodeAt equivalent result with UTF - 16 encoding |
36,366 | public static function trans ( string $ string , string $ target = 'en' , string $ source = null , array $ options = [ ] , TokenProviderInterface $ tokenProvider = null ) { return ( new self ) -> setTokenProvider ( $ tokenProvider ?? new GoogleTokenGenerator ) -> setOptions ( $ options ) -> setSource ( $ source ) -> se... | Override translate method for static call . |
36,367 | public function generateToken ( string $ source , string $ target , string $ text ) : string { return sprintf ( '%d.%d' , rand ( 10000 , 99999 ) , rand ( 10000 , 99999 ) ) ; } | Generate a fake token just as an example . |
36,368 | public function addPeriodicTimer ( int $ interval , callable $ callback ) : void { $ this -> loop -> addPeriodicTimer ( $ interval , $ callback ) ; } | Add a periodic timer |
36,369 | public static function logRequest ( OutputInterface $ output , int $ responseCode , ServerRequestInterface $ request ) : void { $ wrapOpen = '' ; $ wrapClose = '' ; if ( $ responseCode >= 400 ) { $ wrapOpen = '<comment>' ; $ wrapClose = '</comment>' ; } $ output -> writeln ( sprintf ( '%s[%s] "%s %s HTTP/%s" %s%s' , $ ... | Log a request |
36,370 | public function beforeConvert ( ConvertEvent $ convertEvent ) : void { if ( $ convertEvent -> isHandledBy ( SculpinMarkdownBundle :: CONVERTER_NAME , SculpinTwigBundle :: FORMATTER_NAME ) ) { $ content = $ convertEvent -> source ( ) -> content ( ) ; foreach ( self :: $ addPlaceholderRe as $ re ) { $ content = preg_repl... | Called before conversion |
36,371 | public function afterConvert ( ConvertEvent $ convertEvent ) : void { if ( $ convertEvent -> isHandledBy ( SculpinMarkdownBundle :: CONVERTER_NAME , SculpinTwigBundle :: FORMATTER_NAME ) ) { $ content = $ convertEvent -> source ( ) -> content ( ) ; $ content = preg_replace ( self :: $ removePlaceholderRe , '' , $ conte... | Called after conversion |
36,372 | public function mergeSource ( SourceInterface $ source ) : void { if ( array_key_exists ( $ source -> sourceId ( ) , $ this -> sources ) ) { unset ( $ this -> sources [ $ source -> sourceId ( ) ] ) ; } else { $ this -> newSources [ $ source -> sourceId ( ) ] = $ source ; } $ this -> sources [ $ source -> sourceId ( ) ]... | Add this source to the list tracking whether its a new or existing source . |
36,373 | public function reset ( ) : void { foreach ( $ this -> sources as $ source ) { $ source -> setHasNotChanged ( ) ; } $ this -> newSources = [ ] ; } | Reset all sources . |
36,374 | public function generateHeaderId ( string $ headerText ) : string { $ result = strip_tags ( $ headerText ) ; $ result = preg_replace ( '% (?<= \\]) # Look behind to find ] ( \\( # match ( [^\\)]* # match everything except ) \\) # match ) ... | This method is called to generate an id = attribute for a header . |
36,375 | private function outputTags ( OutputInterface $ output , bool $ showPrivate = false ) : void { $ container = $ this -> getContainer ( ) ; if ( ! $ container instanceof ContainerBuilder ) { return ; } $ tags = $ container -> findTags ( ) ; asort ( $ tags ) ; $ label = 'Tagged services' ; $ output -> writeln ( $ this -> ... | Renders list of tagged services grouped by tag |
36,376 | public function sort ( ) { $ index = 0 ; $ comparator = [ $ this -> sorter , 'sort' ] ; foreach ( $ this -> items as & $ item ) { $ item = [ $ index ++ , $ item ] ; } unset ( $ item ) ; uasort ( $ this -> items , function ( $ a , $ b ) use ( $ comparator ) { $ result = $ comparator ( $ a [ 1 ] , $ b [ 1 ] ) ; return $ ... | Sorts proxy source items using the StableSort algorithm from Martijn van der Lee |
36,377 | public function invalidateLoadedTemplates ( ) : void { try { $ me = new \ ReflectionClass ( $ this ) ; $ parent = $ me ; while ( $ parent instanceof \ ReflectionClass ) { $ me = $ parent ; $ parent = $ me -> getParentClass ( ) ; } $ templates = $ me -> getProperty ( 'loadedTemplates' ) ; $ templates -> setAccessible ( ... | We aren t supposed to be using loadTemplate directly and Twig V2 took away our ability to invalidate it . |
36,378 | public function addExclude ( string $ pattern ) : self { if ( substr ( $ pattern , 0 , 2 ) == './' ) { $ pattern = substr ( $ pattern , 2 ) ; } if ( ! in_array ( $ pattern , $ this -> excludes ) ) { $ this -> excludes [ ] = $ pattern ; } return $ this ; } | Add an exclude pattern |
36,379 | public function addIgnore ( string $ pattern ) : self { if ( substr ( $ pattern , 0 , 2 ) == './' ) { $ pattern = substr ( $ pattern , 2 ) ; } if ( ! in_array ( $ pattern , $ this -> ignores ) ) { $ this -> ignores [ ] = $ pattern ; } return $ this ; } | Add an ignore pattern |
36,380 | public function addRaw ( string $ pattern ) : self { if ( substr ( $ pattern , 0 , 2 ) == './' ) { $ pattern = substr ( $ pattern , 2 ) ; } if ( ! in_array ( $ pattern , $ this -> raws ) ) { $ this -> raws [ ] = $ pattern ; } return $ this ; } | Add a raw pattern |
36,381 | public function create ( ) : ConfigurationInterface { $ config = $ this -> detectConfig ( ) ; $ config -> set ( 'env' , $ this -> environment ) ; return $ config ; } | Create Site Configuration |
36,382 | public function detectConfig ( ) : ConfigurationInterface { if ( file_exists ( $ file = $ this -> rootDir . '/config/sculpin_site_' . $ this -> environment . '.yml' ) ) { return $ this -> getConfigFile ( $ file ) ; } if ( file_exists ( $ file = $ this -> rootDir . '/config/sculpin_site.yml' ) ) { return $ this -> getCo... | Detect configuration file and create Site Configuration from it |
36,383 | public function isFormattedBy ( string $ requestedFormatter ) : bool { return $ requestedFormatter == ( $ this -> source -> data ( ) -> get ( 'formatter' ) ? : $ this -> defaultFormatter ) ; } | Test if Source is formatted by requested formatter |
36,384 | public function isHandledBy ( string $ requestedConverter , string $ requestedFormatter ) : bool { return $ this -> isConvertedBy ( $ requestedConverter ) and $ this -> isFormattedBy ( $ requestedFormatter ) ; } | Test if Source is converted and formatted by requested converter and formatter |
36,385 | private function clean ( InputInterface $ input , OutputInterface $ output , string $ dir ) : void { $ fileSystem = $ this -> getContainer ( ) -> get ( 'filesystem' ) ; if ( $ fileSystem -> exists ( $ dir ) ) { if ( $ input -> isInteractive ( ) ) { $ helper = $ this -> getHelper ( 'question' ) ; $ question = new Confir... | Cleanup an output directory by deleting it . |
36,386 | private function getPermaLinkTemplate ( SourceInterface $ source ) : string { $ permalink = $ source -> data ( ) -> get ( 'permalink' ) ; if ( ! $ permalink ) { $ permalink = $ this -> defaultPermalink ; } return $ permalink ; } | Getting the permalink template |
36,387 | private function isDatePath ( string $ path ) : ? array { if ( preg_match ( '/(\d{4})[\/\-]*(\d{2})[\/\-]*(\d{2})[\/\-]*(.+?)(\.[^\.]+|\.[^\.]+\.[^\.]+)$/' , $ path , $ matches ) ) { return [ $ matches [ 1 ] , $ matches [ 2 ] , $ matches [ 3 ] , $ matches [ 4 ] ] ; } return null ; } | Does the specified path represent a date? |
36,388 | private function normalize ( string $ param , string $ space = '-' ) : string { $ param = trim ( $ param ) ; if ( function_exists ( 'iconv' ) ) { $ param = @ iconv ( 'utf-8' , 'us-ascii//TRANSLIT' , $ param ) ; } $ param = preg_replace ( '/[^a-zA-Z0-9 -]/' , '' , $ param ) ; $ param = strtolower ( $ param ) ; $ param =... | Normalize parameter to be used in human readable URL |
36,389 | public function beforeRun ( SourceSetEvent $ sourceSetEvent ) : void { $ updated = $ sourceSetEvent -> updatedSources ( ) ; if ( $ updated ) { $ this -> twig -> invalidateLoadedTemplates ( ) ; } } | Invalidate templates if any of the sources have been updated . |
36,390 | public function registerConverter ( string $ name , ConverterInterface $ converter ) : void { $ this -> converters [ $ name ] = $ converter ; } | Add a converter to the manager . |
36,391 | public function convertSource ( SourceInterface $ source ) : void { $ converters = $ source -> data ( ) -> get ( 'converters' ) ; if ( ! $ converters || ! is_array ( $ converters ) ) { $ converters = [ 'null' ] ; } foreach ( $ converters as $ converter ) { $ this -> eventDispatcher -> dispatch ( Sculpin :: EVENT_BEFORE... | Convert a source to the output . |
36,392 | public function dataProvider ( string $ name ) : DataProviderInterface { if ( isset ( $ this -> dataProviders [ $ name ] ) ) { return $ this -> dataProviders [ $ name ] ; } throw new \ InvalidArgumentException ( sprintf ( "Requested data provider '%s' could not be found; does the content type exist, or provider not spe... | Get a data provider by name . |
36,393 | public function themePath ( string $ resource ) : string { if ( null === $ this -> theme ) { return $ resource ; } if ( file_exists ( $ this -> sourceDirectory . '/' . $ resource ) ) { return $ resource ; } $ themeResource = $ this -> findThemeResource ( $ this -> theme , $ resource ) ; if ( null !== $ themeResource ) ... | Generate a URL for a Theme s resource |
36,394 | public function themePathExists ( string $ resource ) : bool { if ( file_exists ( $ this -> sourceDirectory . '/' . $ resource ) ) { return true ; } if ( null === $ this -> theme ) { return false ; } $ themeResource = $ this -> findThemeResource ( $ this -> theme , $ resource ) ; if ( null !== $ themeResource ) { retur... | Check to see if a given Theme resource exists anywhere on disk |
36,395 | public function themePaths ( string $ resource ) : array { $ paths = [ ] ; if ( file_exists ( $ this -> sourceDirectory . '/' . $ resource ) ) { $ paths [ ] = $ resource ; } if ( null === $ this -> theme ) { return $ paths ; } $ themeResource = $ this -> findThemeResource ( $ this -> theme , $ resource ) ; if ( null !=... | Generate a collection of URLs for a Theme s resource |
36,396 | public function beforeRun ( SourceSetEvent $ sourceSetEvent ) : void { foreach ( $ sourceSetEvent -> updatedSources ( ) as $ source ) { foreach ( $ this -> extensions as $ extension ) { if ( fnmatch ( "*.{$extension}" , $ source -> filename ( ) ) ) { $ source -> data ( ) -> append ( 'converters' , SculpinTextileBundle ... | Event hook to register this converter for all sources that have markdown file extensions . |
36,397 | public function detect ( string $ str ) : LanguageResult { $ str = mb_strtolower ( $ str ) ; $ samples = $ this -> getNgrams ( $ str ) ; $ result = [ ] ; if ( count ( $ samples ) > 0 ) { foreach ( $ this -> tokens as $ lang => $ value ) { $ index = $ sum = 0 ; $ value = array_flip ( $ value ) ; foreach ( $ samples as $... | Detects the language from a given text string |
36,398 | public function learn ( string $ dirname = '' ) { if ( empty ( $ dirname ) ) { $ dirname = __DIR__ . '/../../resources/*/*.txt' ; } else if ( ! is_dir ( $ dirname ) || ! is_readable ( $ dirname ) ) { throw new \ InvalidArgumentException ( 'Provided directory could not be found or is not readable' ) ; } else { $ dirname... | Generates language profiles for all language files |
36,399 | protected function getProfile ( ) { if ( empty ( $ this -> profile ) ) { $ profiles = $ this -> discovery -> scan ( 'profile' ) ; if ( empty ( $ profiles [ 'lightning' ] ) ) { throw new \ RuntimeException ( 'Lightning profile not found.' ) ; } $ this -> profile = $ profiles [ 'lightning' ] ; } return $ this -> profile ... | Returns an extension object for the Lightning profile . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.