idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
300 | public function down ( array $ elementRef = null , $ x = 0 , $ y = 0 ) { return $ this -> switchIsDown ( ) -> addAction ( WebDriver_Server_Selendroid :: ACTION_POINTER_DOWN , $ this -> getCoordParams ( $ elementRef , $ x , $ y ) ) ; } | Puts pointer down . |
301 | public function flickUp ( $ x , $ y , $ distance , $ duration ) { return $ this -> flick ( $ x , $ y , WebDriver_Server_Selendroid :: DIRECTION_UP , $ distance , $ duration ) ; } | Flicks screen up . |
302 | public function flickDown ( $ x , $ y , $ distance , $ duration ) { return $ this -> flick ( $ x , $ y , WebDriver_Server_Selendroid :: DIRECTION_DOWN , $ distance , $ duration ) ; } | Flicks screen down . |
303 | public function flickLeft ( $ x , $ y , $ distance , $ duration ) { return $ this -> flick ( $ x , $ y , WebDriver_Server_Selendroid :: DIRECTION_LEFT , $ distance , $ duration ) ; } | Flicks screen to the left . |
304 | public function flickRight ( $ x , $ y , $ distance , $ duration ) { return $ this -> flick ( $ x , $ y , WebDriver_Server_Selendroid :: DIRECTION_RIGHT , $ distance , $ duration ) ; } | Flicks screen to the right . |
305 | public function slowFlick ( array $ elementRef = null , $ x , $ y , $ direction , $ distance ) { $ stepSize = 30 ; $ stepCount = ( int ) ( $ distance - $ distance % $ stepSize ) / $ stepSize ; $ this -> down ( $ elementRef , $ x , $ y ) ; list ( $ xMultiplier , $ yMultiplier ) = $ this -> getDirectionMultipliers ( $ di... | Builds flick that avoids kick in the end . |
306 | public static function getSocialRecord ( $ gid , $ raw = false ) { $ ch = curl_init ( Configuration :: getPrimaryGSLSNode ( ) . '/' . $ gid ) ; if ( Configuration :: getCurlVerbose ( ) >= 2 ) curl_setopt ( $ ch , CURLOPT_VERBOSE , 1 ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , 1 ) ; curl_setopt ( $ ch , CURLOPT_HT... | Retrieves a SocialRecord for a given GlobalID from the GSLS . The signed JWT stored in the GSLS will be retrieved the payloads verified and the enclosed SocialRecord object will be returned . |
307 | public static function postSocialRecord ( SocialRecord $ sr , $ personalPrivateKey ) { if ( ! $ sr -> verify ( ) ) throw new \ Exception ( "Error: Invalid Social Record" ) ; $ signer = new Sha512 ( ) ; $ personalPrivateKey = PrivateKey :: formatPEM ( $ personalPrivateKey ) ; $ token = ( new Builder ( ) ) -> set ( 'soci... | Pushes a new SocialRecord to the GSLS . The SocialRecord will be transformed into a signed JWT which is then stored in the GSLS |
308 | public static function createJWT ( SocialRecord $ sr , $ personalPrivateKey ) { $ signer = new Sha512 ( ) ; return ( new Builder ( ) ) -> set ( 'socialRecord' , base64_encode ( $ sr -> getJSONString ( ) ) ) -> sign ( $ signer , $ personalPrivateKey ) -> getToken ( ) ; } | creates a signed JWT |
309 | public function parseResultMovieItem ( $ fallbackUrl = null ) { $ resultItem = $ this -> parseResultItem ( $ this -> crawler , 'mid' , '.info' , $ fallbackUrl ) ; if ( $ resultItem == null ) { return null ; } $ movie = new Movie ( $ resultItem ) ; return $ movie ; } | Parses the First Movie as Result Item . |
310 | public function parseResultTheaterItem ( $ fallbackUrl = null ) { $ resultItem = $ this -> parseResultItem ( $ this -> crawler , 'tid' , '.address, .info' , $ fallbackUrl ) ; if ( $ resultItem == null ) { return null ; } $ theater = new Theater ( $ resultItem ) ; return $ theater ; } | Parses the First Theater as Result Item . |
311 | public static function flatten ( $ array ) { $ return = [ ] ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ return = \ array_merge ( $ return , static :: flatten ( $ value ) ) ; } elseif ( $ value instanceof Collection ) { $ return = \ array_merge ( $ return , static :: flatten ( $ value -> ... | Flattens nested arrays or Collections into a single array |
312 | protected function validateCustomer ( CustomerInterface $ value ) { if ( empty ( $ value -> getFullName ( ) ) || empty ( $ value -> getEmail ( ) ) ) { throw new InvalidArgumentException ( 'Customer name and email address is expected' ) ; } } | Validate if we got a good Customer instance . |
313 | protected static function checkVersion ( ) { if ( self :: $ checked === true ) { return true ; } $ process = new \ SystemProcess \ SystemProcess ( 'git' ) ; $ process -> nonZeroExitCodeException = true ; $ process -> argument ( '--version' ) -> execute ( ) ; if ( ! preg_match ( '(\\d+(?:\.\\d+)+)' , $ process -> stdout... | Verify git version |
314 | public function addNode ( string $ className ) : void { if ( isset ( $ this -> nodes [ $ className ] ) ) { return ; } $ this -> nodes [ $ className ] = new DocumentGraphNode ( $ className ) ; } | Adds a node to the dependency graph . |
315 | public function connect ( string $ source , string $ destination ) : void { $ outNode = $ this -> nodes [ $ source ] ; $ inNode = $ this -> nodes [ $ destination ] ; $ edge = new DocumentGraphEdge ( $ outNode , $ inNode ) ; $ outNode -> addOutEdge ( $ edge ) ; $ inNode -> addInEdge ( $ edge ) ; } | Connects two nodes . |
316 | protected function debugGetRelatedName ( $ e , EntityFace $ face ) { $ names = [ ] ; foreach ( $ face -> getElements ( ) as $ elm ) { if ( StringUtils :: beginsWith ( $ e , $ elm -> getName ( ) ) ) { $ names [ ] = $ elm -> getName ( ) ; } else if ( StringUtils :: endsWith ( $ e , $ elm -> getName ( ) ) ) { $ names [ ] ... | Allows to debug typos etc .. |
317 | public function addSelector ( $ key , FullParamIdentifier $ paramId ) { if ( $ this -> noIdentifierFor ( $ key ) ) { $ this -> fullParamIdentifierByKey [ $ key ] = [ ] ; } $ this -> fullParamIdentifierByKey [ $ key ] [ ] = $ paramId ; } | Adds a new full param identifier to the map . |
318 | public function setSport ( ChildSport $ v = null ) { if ( $ v === null ) { $ this -> setSportId ( NULL ) ; } else { $ this -> setSportId ( $ v -> getId ( ) ) ; } $ this -> aSport = $ v ; if ( $ v !== null ) { $ v -> addPosition ( $ this ) ; } return $ this ; } | Declares an association between this object and a ChildSport object . |
319 | public function initSkillsRelatedByStartPositionId ( $ overrideExisting = true ) { if ( null !== $ this -> collSkillsRelatedByStartPositionId && ! $ overrideExisting ) { return ; } $ this -> collSkillsRelatedByStartPositionId = new ObjectCollection ( ) ; $ this -> collSkillsRelatedByStartPositionId -> setModel ( '\goss... | Initializes the collSkillsRelatedByStartPositionId collection . |
320 | public function getSkillsRelatedByStartPositionIdJoinFeaturedPicture ( Criteria $ criteria = null , ConnectionInterface $ con = null , $ joinBehavior = Criteria :: LEFT_JOIN ) { $ query = ChildSkillQuery :: create ( null , $ criteria ) ; $ query -> joinWith ( 'FeaturedPicture' , $ joinBehavior ) ; return $ this -> getS... | If this collection has already been initialized with an identical criteria it returns the collection . Otherwise if this Position is new it will return an empty collection ; or if this Position has previously been saved it will retrieve related SkillsRelatedByStartPositionId from storage . |
321 | public function initSkillsRelatedByEndPositionId ( $ overrideExisting = true ) { if ( null !== $ this -> collSkillsRelatedByEndPositionId && ! $ overrideExisting ) { return ; } $ this -> collSkillsRelatedByEndPositionId = new ObjectCollection ( ) ; $ this -> collSkillsRelatedByEndPositionId -> setModel ( '\gossi\trixio... | Initializes the collSkillsRelatedByEndPositionId collection . |
322 | public function getSkillsRelatedByEndPositionIdJoinSport ( Criteria $ criteria = null , ConnectionInterface $ con = null , $ joinBehavior = Criteria :: LEFT_JOIN ) { $ query = ChildSkillQuery :: create ( null , $ criteria ) ; $ query -> joinWith ( 'Sport' , $ joinBehavior ) ; return $ this -> getSkillsRelatedByEndPosit... | If this collection has already been initialized with an identical criteria it returns the collection . Otherwise if this Position is new it will return an empty collection ; or if this Position has previously been saved it will retrieve related SkillsRelatedByEndPositionId from storage . |
323 | public function addError ( $ errorKey , $ errorValue ) { if ( ! isset ( $ this -> errors [ $ errorKey ] ) ) { $ this -> errors [ $ errorKey ] = [ ] ; } $ this -> errors [ $ errorKey ] [ ] = $ errorValue ; } | Add an error to the internal error array |
324 | public function validateMultipleItems ( array $ validationRule , array $ items , $ fullyQualifiedName ) { $ itemNumber = 1 ; foreach ( $ items as $ item ) { $ tempRule = $ validationRule ; $ tempRule [ 'name' ] = empty ( $ validationRule [ 'name' ] ) ? 'Value number ' . $ itemNumber : $ validationRule [ 'name' ] . ' nu... | Validate a multile items using the given validation rule . |
325 | public function getTypeValidator ( $ type ) { if ( in_array ( $ type , $ this -> allowedTypeValidators , true ) == false ) { throw new InvalidTypeValidatorException ( 'The type "' . $ type . '" is invalid' ) ; } if ( isset ( $ this -> typeValidators [ $ type ] ) == false ) { $ className = 'Mooti\\Validator\\TypeValidat... | Get a type validator |
326 | public function renderAction ( ) { $ params = $ this -> params ( ) ; $ navigation = $ this -> getServiceLocator ( ) -> get ( 'Grid\Menu\Model\Menu\Model' ) -> findNavigation ( $ params -> fromRoute ( 'id' ) ) ; $ view = new ViewModel ( array ( 'navigation' => $ navigation , 'class' => $ params -> fromRoute ( 'class' ) ... | Render a standalone menu |
327 | public function create ( $ product , $ data , $ storeView = null , $ identifierType = null ) { return $ this -> __createAction ( 'catalogProductAttributeMediaCreate' , func_get_args ( ) ) ; } | Allows you to upload a new product image . |
328 | public function getInfo ( $ productId , $ file , $ storeView = null , $ identifierType = null ) { return $ this -> __createAction ( 'catalogProductAttributeMediaInfo' , func_get_args ( ) ) ; } | Allows you to retrieve information about the specified product image . |
329 | public function update ( $ productId , $ file , $ data , $ storeView = null , $ identifierType = null ) { return $ this -> __createAction ( 'catalogProductAttributeMediaUpdate' , func_get_args ( ) ) ; } | Allows you to update the product image . |
330 | public function add ( $ path , $ group = null , $ depth = null ) { if ( isset ( $ this -> working_group ) ) { $ group = $ this -> working_group ; } else if ( ! isset ( $ group ) ) { throw new RuntimeException ( "Must set group or working group to add directory." ) ; } if ( ! isset ( $ this -> groups [ $ group ] ) ) { $... | Adds a directory path to a group . |
331 | public function locate ( $ file , $ group = null ) { if ( isset ( $ this -> working_group ) ) { $ group = $ this -> working_group ; } else if ( ! isset ( $ group ) ) { throw new RuntimeException ( "Must set group or working group to locate file." ) ; } if ( isset ( $ this -> found [ $ group ] [ $ file ] ) ) { return $ ... | Attempts to locate a file in a given group s directories . |
332 | public function search ( $ dir , $ file , $ depth = null , $ depth_now = 0 ) { if ( ! isset ( $ depth ) ) { $ depth = $ this -> default_search_depth ; } foreach ( $ this -> glob ( $ dir ) as $ item ) { if ( false !== strpos ( $ item , $ file ) ) { return $ item ; } else if ( $ depth_now < $ depth && $ this -> ds === su... | Searches for a file by globbing recursively until the file is found or until the maximum recusion depth is reached . |
333 | public function glob ( $ dir ) { $ dir = $ this -> cleanpath ( $ dir ) ; if ( isset ( $ this -> globs [ $ dir ] ) ) { return $ this -> globs [ $ dir ] ; } return $ this -> globs [ $ dir ] = glob ( $ dir . '/*' , GLOB_MARK | GLOB_NOSORT | GLOB_NOESCAPE ) ; } | Gets a glob of a directory . |
334 | public function setContainer ( ContainerInterface $ container = null ) { $ this -> container = $ container ; if ( $ this -> container -> has ( 'request' ) && $ this -> container -> hasScope ( 'request' ) && $ this -> container -> isScopeActive ( 'request' ) ) { $ this -> request = $ this -> container -> get ( 'request'... | Sets the Container . |
335 | public function beforePrepare ( Event $ event ) { $ command = $ event [ 'command' ] ; $ client = $ command -> getClient ( ) ; $ config = $ client -> getConfig ( ) ; if ( $ command -> getOperation ( ) -> hasParam ( 'appKey' ) ) { $ command [ 'appKey' ] = $ config -> get ( 'appKey' ) ; if ( ! $ command [ 'authMode' ] && ... | Inject authorization data into commands . |
336 | protected static function getAuthHeader ( $ scheme , $ username , $ password = null ) { if ( ! $ password ) return $ scheme . ' ' . $ username ; return $ scheme . ' ' . base64_encode ( $ username . ':' . $ password ) ; } | Get the authorization header value for a request . |
337 | public function sendEmail ( $ user , $ subject = "" , $ viewFile , $ content = array ( ) , $ return = true , $ processOutput = true , $ debug = false ) { Yii :: log ( Yii :: t ( 'ciims.core' , 'Use of CiiController::sendEmail is deprecated, and will be dropped in a future version. Use EmailSettings::send instead' ) , '... | Generic method for sending an email . Instead of having to call a bunch of code all over over the place This method can be called which should be able to handle almost anything . |
338 | public function getTheme ( ) { if ( $ this -> theme != NULL ) return $ this -> themeName ; $ theme = Cii :: getConfig ( 'theme' , 'default' ) ; Yii :: app ( ) -> setTheme ( file_exists ( YiiBase :: getPathOfAlias ( 'base.themes.' . $ theme ) ) ? $ theme : 'default' ) ; $ this -> themeName = $ theme ; return $ theme ; } | Retrieves the appropriate theme |
339 | public function getKeywords ( ) { $ keywords = Cii :: get ( $ this -> params [ 'meta' ] , 'keywords' , '' ) ; if ( Cii :: get ( $ keywords , 'value' , false ) != false ) $ keywords = implode ( ',' , json_decode ( $ keywords [ 'value' ] ) ) ; return $ keywords == "" ? Cii :: get ( $ this -> params [ 'data' ] , 'title' ,... | Retrieves keywords for use in the viewfile |
340 | public function render ( $ view , $ data = null , $ return = false ) { if ( $ this -> beforeRender ( $ view ) ) { if ( empty ( $ this -> params [ 'meta' ] ) ) $ data [ 'meta' ] = array ( ) ; if ( isset ( $ data [ 'data' ] ) && is_object ( $ data [ 'data' ] ) ) $ this -> params [ 'data' ] = $ data [ 'data' ] -> attribut... | Overloaded Render allows us to generate dynamic content |
341 | public function setLevel ( $ level ) { if ( ( $ level < 0 ) || ( $ level > 9 ) ) { throw new Exception \ InvalidArgumentException ( 'Level must be between 0 and 9' ) ; } $ this -> options [ 'level' ] = ( int ) $ level ; return $ this ; } | Sets a new compression level |
342 | public function setMode ( $ mode ) { if ( ( $ mode != 'compress' ) && ( $ mode != 'deflate' ) ) { throw new Exception \ InvalidArgumentException ( 'Given compression mode not supported' ) ; } $ this -> options [ 'mode' ] = $ mode ; return $ this ; } | Sets a new compression mode |
343 | public function getClassAndMethodNamesForCalling ( ) : array { $ domain = $ this -> consoleInput -> getDomainName ( ) ; $ action = $ this -> consoleInput -> getActionName ( ) ; $ className = self :: getFQDNClass ( $ domain ) ; return [ $ className , $ domain , $ action ] ; } | Generate the NAMESPACE CLASSNAME AND ACTION for calling |
344 | public static function configureWithPreset ( $ preset , $ settings = null ) { if ( is_string ( $ settings ) ) { return self :: configureWithPreset ( $ preset , json_decode ( file_get_contents ( $ settings ) , true ) ) ; } if ( ! array_key_exists ( $ preset , self :: $ config ) || is_null ( self :: $ config [ $ preset ]... | Configure the Maestrano PHP SDK using the Developer Platform |
345 | public static function loadMarketplacesConfigWithPreset ( $ preset ) { if ( self :: $ cache == NULL ) self :: $ cache = new Maestrano_Util_Cache ( ) ; self :: $ cache -> cache_path = dirname ( __FILE__ ) . '/' ; self :: $ cache -> cache_time = 43200 ; if ( ! $ data = self :: $ cache -> get_cache ( 'dev-platform' ) ) { ... | Fetch the dynamic marketplaces configuration for this environment and configure the Maestrano presets |
346 | public static function loadMultipleMarketplaces ( $ conf_array ) { foreach ( $ conf_array as $ marketplace ) { Maestrano :: with ( $ marketplace [ 'marketplace' ] ) -> configure ( $ marketplace ) ; } } | Configure Maestrano presets with fetched marketplaces |
347 | private static function configureDevPlatformSetting ( $ setting_bloc , $ var_name , $ env_var , $ preset , $ settings ) { if ( $ settings != null && array_key_exists ( $ setting_bloc , $ settings ) && array_key_exists ( $ var_name , $ settings [ $ setting_bloc ] ) ) { self :: $ config [ $ preset ] [ "$setting_bloc.$var... | Configure a dev platform setting in the dev platform settings preset |
348 | public function add ( $ handle , $ type , $ args = array ( ) ) { list ( $ src , $ deps , $ ver , $ last ) = $ args ; $ data = array ( ) ; if ( $ src ) $ data [ 'src' ] = $ src ; if ( $ deps ) $ data [ 'deps' ] = $ deps ; if ( $ ver ) $ data [ 'ver' ] = $ ver ; if ( $ last ) $ data [ ( 'script' == $ type ? 'in_footer' :... | Generic add function |
349 | public function remove ( $ handle , $ type = null ) { if ( ! $ type ) { $ script = false !== array_search ( $ handle , array_keys ( $ this -> assets [ 'script' ] ) ) ; $ style = false !== array_search ( $ handle , array_keys ( $ this -> assets [ 'style' ] ) ) ; if ( $ script && $ style ) { throw new \ RuntimeException ... | Removes asset when no type is given it tries to find it |
350 | public function enqueue ( ) { if ( $ this -> assets ) { foreach ( $ this -> assets as $ type => $ assets ) { $ registerFunc = 'wp_register_' . $ type ; $ enqueueFunc = 'wp_enqueue_' . $ type ; foreach ( $ assets as $ handle => $ data ) { if ( $ data ) { $ data = array_merge ( array ( 'src' => null , 'deps' => array ( )... | Enqueues all assets |
351 | public function execute ( Framework $ framework , RequestAbstract $ request , Response $ response ) { if ( $ request instanceof WebRequest ) { $ response -> redirectTo ( '/login/' , 307 , true ) ; return ; } $ response -> setOutputPart ( 'sessionNeeded' , 'You need a session to execute this command!' ) ; } | If the request is a WebRequest the user will be redirected to the login page . Otherwise the event handler will display an information message . |
352 | public static function hash_password ( $ uname , $ upass , $ usalt ) { if ( strlen ( $ usalt ) > 16 ) $ usalt = substr ( $ usalt , 0 , 16 ) ; return self :: generate_secret ( $ upass . $ uname , $ usalt ) ; } | Create hashed password . |
353 | public static function verify_password ( $ pass1 , $ pass2 ) { $ pass1 = trim ( $ pass1 ) ; $ pass2 = trim ( $ pass2 ) ; if ( $ pass1 != $ pass2 ) return AdminStoreError :: PASSWORD_NOT_SAME ; if ( strlen ( $ pass1 ) < 4 ) return AdminStoreError :: PASSWORD_TOO_SHORT ; return 0 ; } | Verify plaintext password . |
354 | public static function generate_secret ( $ data , $ key = null , $ length = 64 ) { if ( ! $ key ) $ key = uniqid ( ) . ( string ) mt_rand ( ) ; $ bstr = $ data . $ key ; $ bstr = hash_hmac ( 'sha256' , $ bstr , $ key , true ) ; $ bstr = base64_encode ( $ bstr ) ; $ bstr = str_replace ( [ '/' , '+' , '=' ] , '' , $ bstr... | Generate salt . |
355 | public static function verify_site_url ( $ url ) { $ url = trim ( $ url ) ; if ( ! $ url || strlen ( $ url ) > 64 ) return false ; return filter_var ( $ url , FILTER_VALIDATE_URL ) ; } | Verify site url |
356 | public static function verify_email_address ( $ email ) { $ email = trim ( $ email ) ; if ( ! $ email || strlen ( $ email ) > 64 ) return false ; return filter_var ( $ email , FILTER_VALIDATE_EMAIL ) ; } | Verify email address . |
357 | public function method ( $ class , $ method , array $ params = [ ] , $ forceScopeCalls = false ) { $ reflectionClass = new \ ReflectionClass ( is_string ( $ class ) ? $ this -> laraApp -> make ( $ class ) : $ class ) ; $ reflectionMethod = $ reflectionClass -> getMethod ( $ method ) ; $ resolved = $ this -> resolve ( $... | Resolves class method and calls it . |
358 | protected function _normalizeContainer ( $ container ) { if ( ! ( $ container instanceof BaseContainerInterface ) && ! ( $ container instanceof stdClass ) && ! ( $ container instanceof ArrayAccess ) && ! is_array ( $ container ) ) { throw $ this -> _createInvalidArgumentException ( $ this -> __ ( 'Invalid container' ) ... | Normalizes a container . |
359 | public function configure ( ArrayNodeDefinition $ builder ) { $ children = $ builder -> children ( ) ; $ children -> scalarNode ( 'phantom_server' ) -> isRequired ( ) -> end ( ) ; $ children -> scalarNode ( 'template_cache' ) -> defaultNull ( ) -> end ( ) ; } | Setups configuration for the driver factory . |
360 | protected static function normalizeUploadedFiles ( array $ uploadedFiles ) { $ files = [ ] ; foreach ( $ uploadedFiles as $ key => $ value ) { if ( $ value instanceof UploadedFileInterface ) { $ files [ $ key ] = $ value ; } elseif ( is_array ( $ value ) && isset ( $ value [ 'tmp_name' ] ) ) { $ files [ $ key ] = stati... | Normalizes the value of uploadedFiles . |
361 | public function transform ( Did $ did ) { return [ 'id' => $ did -> id , 'text' => $ did -> text , 'created_at' => $ did -> created_at -> toIso8601String ( ) ] ; } | Turn this item object into a generic array |
362 | public function hydrate ( $ classNameOrObject , iterable $ values ) : object { ensure_data ( $ classNameOrObject ) -> isTypeOf ( 'string' , 'object' ) ; return $ this -> denormalize ( $ values , $ classNameOrObject ) ; } | Crea un objeto a partir de un array |
363 | public function extract ( object $ object , string $ snakeCaseSeparator = '_' ) : array { $ this -> nameConverter -> setSnakeCaseSeparator ( $ snakeCaseSeparator ) ; return $ this -> normalize ( $ object ) ; } | Crea un array a partir de un objeto |
364 | public static function encode ( $ data ) { $ json = json_encode ( $ data , JSON_UNESCAPED_SLASHES ) ; $ json = str_replace ( [ "\t" , "\r" , "\n" ] , [ '\\t' , '\\r' , '\\n' ] , $ json ) ; return $ json ; } | Encodes the passed parameter into JSON . Slashes in the resulting JSON will not be escaped per newest Internet standards . |
365 | public static function registerPolicy ( $ config ) { $ modeloM = ucfirst ( basename ( $ config [ 'modelo' ] ) ) ; $ modelo = strtolower ( $ modeloM ) ; $ policyName = $ modeloM . 'Policy' ; $ path = str_finish ( str_replace ( [ "/" ] , [ "\\" ] , app_path ( 'Providers/AuthServiceProvider.php' ) ) , '.php' ) ; $ policyP... | Register a Model Policy in AuthServiceProvider using a config Array |
366 | public static function saveResource ( $ view , $ localized , $ path , $ filename , $ config , $ pathPermissions = 0764 , $ flags = "" ) { $ view = str_start ( $ view , "sirgrimorum::templates." ) ; $ modeloClass = $ config [ 'modelo' ] ; $ modeloM = ucfirst ( basename ( $ config [ 'modelo' ] ) ) ; $ modelo = strtolower... | Create a new Model related file using a view as a template and a config array as directives |
367 | public static function removeFile ( $ filename , $ public = true ) { if ( $ public ) { $ path = public_path ( $ filename ) ; } else { $ path = base_path ( $ filename ) ; } if ( file_exists ( $ path ) ) { unlink ( $ path ) ; } else { return false ; } } | Remove a file if exists |
368 | public static function registerConfig ( $ config , $ path , $ config_path = "" ) { $ inPath = $ path ; $ path = str_finish ( str_replace ( [ "." , "/" ] , [ "\\" , "\\" ] , $ path ) , '.php' ) ; if ( $ config_path == "" ) { $ config_path = config_path ( $ path ) ; } else { $ config_path = base_path ( $ config_path . st... | Register a configuratio array file in the \ Sirgrimorum \ CrudGenerator \ CrudGenerator config file |
369 | public static function saveConfig ( $ config , $ path , $ config_path = "" ) { $ inPath = $ path ; if ( isset ( $ config [ 'parametros' ] ) ) { $ parametros = $ config [ 'parametros' ] ; unset ( $ config [ 'parametros' ] ) ; } else { $ parametros = "" ; } $ path = str_finish ( str_replace ( [ "." , "/" ] , [ "\\" , "\\... | Create a configuration array file form a configuration array |
370 | private static function arrayToFile ( $ array ) { $ strFile = "<?php" . chr ( 13 ) . chr ( 10 ) . chr ( 13 ) . chr ( 10 ) . "return [" . chr ( 13 ) . chr ( 10 ) ; $ strValue = \ Sirgrimorum \ CrudGenerator \ CrudGenerator :: arrayToFileWrite ( $ array , 0 ) ; $ strFile .= $ strValue . "];" ; return $ strFile ; } | Transform an array into a PHP file content string |
371 | private static function arrayToFileWrite ( $ array , $ numParent ) { $ tabs = "" ; for ( $ index = 0 ; $ index <= $ numParent ; $ index ++ ) { $ tabs .= chr ( 9 ) ; } $ strArr = "" ; foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { $ strValue = \ Sirgrimorum \ CrudGenerator \ CrudGenerator :: arr... | Transform an array into a string using identation |
372 | public static function filenameIs ( string $ filename , array $ detalles = [ ] ) { $ allowedMimeTypes = [ 'image' => [ 'image/jpeg' , 'image/gif' , 'image/png' , 'image/bmp' , 'image/x-windows-bmp' , 'image/svg+xml' , 'image/x-icon' , 'image/tiff' ] , 'video' => [ 'video/avi' , 'video/mpeg' , 'video/webm' , 'video/mp4'... | Know if a filename in public is an image with configuration array |
373 | public static function fileMime ( string $ filename , array $ detalles = [ ] ) { if ( isset ( $ detalles [ 'path' ] ) ) { $ path = str_start ( str_replace ( "\\" , "/" , $ filename ) , str_finish ( str_replace ( "\\" , "/" , $ detalles [ 'path' ] ) , '/' ) ) ; } else { $ path = $ filename ; } $ ext = pathinfo ( $ path ... | Get Mime of a filename in public with configuration array |
374 | public function setReleases ( $ releases ) { if ( ! is_array ( $ releases ) ) { throw new \ Exception ( "The releases parameter must be an array." ) ; } if ( isset ( $ this -> currentRelease ) ) { if ( ! isset ( $ releases [ $ this -> currentRelease [ 'version' ] ] ) ) { unset ( $ this -> currentRelease ) ; } else { $ ... | Set an array with all releases . The current release must be re - set if this is set and the current release isn t in the array . |
375 | public function setCurrentRelease ( $ currentRelease ) { if ( ! isset ( $ this -> releases [ $ currentRelease [ 'version' ] ] ) ) { throw new \ Exception ( "The current release needs to be part of the release array." ) ; } $ this -> currentRelease = $ currentRelease ; } | Set the current release meaning the latest recommended release . |
376 | public function parse ( string $ input ) : \ DateInterval { $ input = trim ( $ this -> normalizer -> normalize ( $ input ) ) ; $ definition = Pattern :: DEFINE . Pattern :: INTEGER . Pattern :: TIME_PART . ')' ; $ expression = $ definition . Pattern :: INTERVAL_ONLY ; if ( preg_match ( $ expression , $ input , $ matche... | Normalizes any non - strtotime - compatible time string then validates the interval and returns a DateInterval object . No leading or trailing data is accepted . |
377 | public static function normalize ( array $ config ) { $ config [ 'mime_types' ] = ( array ) $ config [ 'mime_types' ] ; $ config [ 'cropper_enabled' ] = ( bool ) $ config [ 'cropper_enabled' ] ; $ config [ 'max_file_size' ] = ( int ) $ config [ 'max_file_size' ] ; $ config [ 'max_height' ] = ( int ) $ config [ 'max_hei... | Normalize image config . |
378 | static public function trigger ( string $ event , array $ args = [ ] , bool $ delete = true , $ newthis = null ) : int { if ( ! self :: exists ( $ event ) ) return 0 ; foreach ( self :: $ listeners [ $ event ] as $ listener ) { static $ count = 0 ; if ( $ newthis ) $ listener = $ listener -> bindTo ( $ newthis ) ; $ li... | Triggers all of an event s listeners . |
379 | public function dump ( $ file , array $ data ) { $ dir = dirname ( $ file ) ; if ( ! is_dir ( $ dir ) ) { mkdir ( $ dir , 0755 , true ) ; } $ fileInfo = new SplFileInfo ( $ file ) ; if ( $ fileInfo -> isFile ( ) ) { if ( $ fileInfo -> isWritable ( ) ) { $ fileObject = $ fileInfo -> openFile ( 'w' ) ; } else { throw new... | Dump config to file |
380 | public function replace ( $ from , $ to ) { if ( \ is_callable ( $ to ) ) { $ to = $ to ( $ from , $ this -> string ) ; } $ this -> string = \ str_replace ( $ from , $ to , $ this -> string ) ; return $ this ; } | Wrapper for str_replace . |
381 | public function ireplace ( $ from , $ to ) { if ( \ is_callable ( $ to ) ) { $ to = $ to ( $ from , $ this -> string ) ; } $ this -> string = \ str_ireplace ( $ from , $ to , $ this -> string ) ; return $ this ; } | Wrapper for str_ireplace . |
382 | public function upper ( $ encoding = null ) { if ( ! $ this -> hasMbstring ( ) ) { return $ this -> transform ( '\strtoupper' ) ; } $ encoding = $ this -> encoding ( $ encoding ) ; return $ this -> transform ( '\mb_convert_case' , MB_CASE_UPPER , $ encoding ) ; } | Wrapper for strtoupper . |
383 | public function lower ( $ encoding = null ) { if ( ! $ this -> hasMbstring ( ) ) { return $ this -> transform ( '\strtolower' ) ; } $ encoding = $ this -> encoding ( $ encoding ) ; return $ this -> transform ( '\mb_convert_case' , MB_CASE_LOWER , $ encoding ) ; } | Wrapper for strtolower . |
384 | public function upperFirst ( $ encoding = null ) { if ( ! $ this -> hasMbstring ( ) ) { return $ this -> transform ( '\ucfirst' ) ; } $ encoding = $ this -> encoding ( $ encoding ) ; $ string = \ mb_strtoupper ( \ mb_substr ( $ this -> string , 0 , 1 , $ encoding ) , $ encoding ) ; $ this -> string = $ string . \ mb_su... | Wrapper for ucfirst . |
385 | public function lowerFirst ( $ encoding = null ) { if ( ! $ this -> hasMbstring ( ) ) { return $ this -> transform ( '\lcfirst' ) ; } $ encoding = $ this -> encoding ( $ encoding ) ; $ string = \ mb_strtolower ( \ mb_substr ( $ this -> string , 0 , 1 , $ encoding ) , $ encoding ) ; $ this -> string = $ string . \ mb_su... | Wrapper for lcfirst . |
386 | public function upperWords ( $ delimiters = null ) { if ( is_null ( $ delimiters ) ) { $ delimiters = " \t\r\n\f\v" ; } if ( ( version_compare ( PHP_VERSION , '5.4.32' , '>=' ) && version_compare ( PHP_VERSION , '5.5.0' , '<' ) ) || version_compare ( PHP_VERSION , '5.5.16' , '>=' ) ) { return $ this -> transform ( 'ucw... | Wrapper for ucwords . |
387 | public function compose ( SQL $ SQL ) { if ( $ this -> _insert ) { return $ this -> _composeInsertQuery ( $ SQL ) ; } else { return $ this -> _composeUpdateQuery ( $ SQL ) ; } } | Composes a query from the QueryBuilder . |
388 | protected function _composeInsertQuery ( SQL $ SQL ) { $ query_pre = "INSERT INTO `$this->_table`" ; if ( empty ( $ this -> _fields ) ) { throw new QueryBuilderException ( 'No fields specified for SQL query' ) ; } $ fields = [ ] ; $ updates = [ ] ; foreach ( $ this -> _fields as $ field => $ value ) { $ prepared = $ th... | Composes an insert query with an on duplicate key update part . |
389 | protected function _composeUpdateQuery ( SQL $ SQL ) { $ condition = parent :: compose ( $ SQL ) ; $ query_pre = "UPDATE `$this->_table` SET " ; $ query_post = " WHERE $condition" ; $ fields = [ ] ; if ( empty ( $ this -> _fields ) ) { throw new QueryBuilderException ( 'No fields specified for SQL query' ) ; } foreach ... | Composes an update query . |
390 | public function create ( $ transport ) { if ( is_string ( $ transport ) ) { $ transport = $ this -> registry -> getTransport ( $ transport ) ; } if ( ! $ transport instanceof TransportInterface ) { throw new \ InvalidArgumentException ( 'transport should a string or a TransportInterface' ) ; } if ( null !== ( $ extensi... | Creates a Jobflow |
391 | public static function decode ( $ json ) { $ object = json_decode ( $ json , true ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { $ error = 'JSON error' ; if ( function_exists ( 'json_last_error_msg' ) ) { $ error = json_last_error_msg ( ) ; } else { switch ( json_last_error ( ) ) { case JSON_ERROR_DEPTH : $ error... | Decode a JSON string . |
392 | protected function GenerateConstantsClass ( $ data ) { if ( count ( $ data ) > 0 ) { $ classGen = new ConstantsAndListClassGenerator ( $ this -> params , $ data ) ; $ classGen -> BuildClass ( ) ; return str_replace ( ".php" , "" , $ classGen -> fileName ) ; } else { return "No class to generate." ; } } | Generate the Constant Class . |
393 | public static function ofObjectType ( $ fullName ) { $ result = self :: of ( $ fullName ) ; if ( ! ( $ result instanceof ObjectType ) ) throw new InvalidArgumentException ( "Argument 'fullName' does not describe a class or interface." ) ; return $ result ; } | Gets a class or interface type with a given name . |
394 | public static function ofClass ( $ fullName ) { $ result = self :: of ( $ fullName ) ; if ( ! ( $ result instanceof ClassType ) ) throw new InvalidArgumentException ( "Argument 'fullName' does not describe a class." ) ; return $ result ; } | Gets a class type with a given name . |
395 | public static function ofInterface ( $ fullName ) { $ result = self :: of ( $ fullName ) ; if ( ! ( $ result instanceof InterfaceType ) ) throw new InvalidArgumentException ( "Argument 'fullName' does not describe an interface." ) ; return $ result ; } | Gets a interface type with a given name . |
396 | public static function of ( $ typeName , RelativeClassNameResolver $ resolver = null ) { $ parts = explode ( "|" , $ typeName ) ; if ( count ( $ parts ) > 1 ) { $ types = array ( ) ; foreach ( $ parts as $ part ) $ types [ ] = self :: of ( $ part , $ resolver ) ; return self :: ofUnion ( $ types ) ; } $ result = Primit... | Gets the type with the provided name . Throws an exception if the type is malformed or does not exist . |
397 | public function equals ( EmailAddressInterface $ emailAddress ) : bool { return $ this -> getHost ( ) -> equals ( $ emailAddress -> getHost ( ) ) && $ this -> getUsername ( ) === $ emailAddress -> getUsername ( ) ; } | Returns true if the email address equals other email address false otherwise . |
398 | public function withUsername ( string $ username ) : EmailAddressInterface { if ( ! self :: myValidateUsername ( $ username , $ error ) ) { throw new EmailAddressInvalidArgumentException ( $ error ) ; } return new self ( $ username , $ this -> myHost ) ; } | Returns a copy of the email address instance with the specified username . |
399 | public static function fromParts ( string $ username , HostInterface $ host ) : EmailAddressInterface { if ( ! self :: myValidateUsername ( $ username , $ error ) ) { throw new EmailAddressInvalidArgumentException ( $ error ) ; } return new self ( $ username , $ host ) ; } | Creates an email address from parts . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.