idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
230,500 | public function setLimit ( $ limit ) { $ message = 'Given limit must be a positive number.' ; Assertion :: numeric ( $ limit , $ message ) ; Assertion :: min ( $ limit , 0 , $ message ) ; $ this -> limit = $ limit ; } | Defines the amount of entities to be fetched from the information provider . |
230,501 | protected function persist ( array $ data ) { Assertion :: notEmpty ( $ this -> persistors , 'No persistor attached.' , DataAggregatorException :: NO_PERSISTOR_ATTACHED ) ; foreach ( $ this -> persistors as $ persistor ) { try { $ persistor -> persist ( $ data ) ; } catch ( PersistorException $ e ) { $ this -> getLogge... | Forwards the gathered data to every registered output handler . |
230,502 | public function attachLoader ( LoaderInterface $ loader , $ key = '' ) { if ( empty ( $ key ) ) { $ this -> loaders [ ] = $ loader ; } else { $ this -> loaders [ $ key ] = $ loader ; } } | Adds given loader to registry . |
230,503 | public function attachPersistor ( PersistorInterface $ persistor , $ key = '' ) { if ( empty ( $ key ) ) { $ this -> persistors [ ] = $ persistor ; } else { $ this -> persistors [ $ key ] = $ persistor ; } } | Adds the given persistor to the collection of output handlers |
230,504 | public static function make ( string $ path , int $ ifExists = File :: MAKE_FILE_EXISTS_THROW_EXCEPTION ) : File { $ exists = File :: exists ( $ path ) ; if ( $ exists ) { if ( $ ifExists === File :: MAKE_FILE_EXISTS_OVERWRITE ) { unlink ( $ path ) ; } else if ( $ ifExists === File :: MAKE_FILE_EXISTS_OPEN ) { return n... | Makes a file . |
230,505 | public function write ( string $ str ) { $ handler = fopen ( $ this -> _path , "w" ) ; fwrite ( $ handler , $ str ) ; fclose ( $ handler ) ; } | Writes a string to the file . |
230,506 | public function read ( int $ length = 1 , int $ offset = 0 ) : string { return substr ( $ this -> getContent ( ) , $ offset , $ length ) ; } | Returns a string of specified length from file . |
230,507 | public function readLine ( int $ line = 1 ) : string { $ lines = file ( $ this -> _path ) ; if ( $ line > count ( $ lines ) ) { throw new LineNumberAboveFileLines ( $ this -> _path , $ line , count ( $ lines ) ) ; } if ( $ line <= 0 ) { $ line = 1 ; } return $ lines [ ( $ line - 1 ) ] ; } | Returns a single line from file . |
230,508 | public function setExtension ( string $ extension ) { $ old = $ this -> getPath ( ) ; $ new = $ this -> getLocation ( ) . DIRECTORY_SEPARATOR . $ this -> getName ( ) ; if ( ! empty ( $ extension ) ) { $ new .= ".{$extension}" ; } if ( rename ( $ old , $ new ) ) { $ this -> _extension = $ extension ; } } | Renames file extension . |
230,509 | public function onPreRoute ( MvcEvent $ event ) { $ serviceManager = $ event -> getApplication ( ) -> getServiceManager ( ) ; $ router = $ event -> getRouter ( ) ; $ config = $ serviceManager -> get ( 'Config' ) ; $ config = isset ( $ config [ 'asset_manager' ] ) && ( is_array ( $ config [ 'asset_manager' ] ) || $ conf... | Late - binding asset routes . |
230,510 | public function onPostRoute ( MvcEvent $ e ) { $ matches = $ e -> getRouteMatch ( ) ; if ( ! $ matches instanceof Router \ RouteMatch ) { return ; } $ routeName = $ matches -> getMatchedRouteName ( ) ; $ routeName = explode ( '/' , $ routeName , 2 ) ; $ routeName = $ routeName [ 0 ] ; if ( $ routeName !== 'asset_manage... | Listen to the route event and determine if an asset should be loaded . |
230,511 | private function doRun ( ) { $ dispatcher = ( new DispatcherInjector ) -> build ( ) ; if ( ( $ response = $ dispatcher -> signal ( 'kernel.request' ) ) instanceof ResponseInterface ) { return $ response ; } $ resolver = $ this -> getResolver ( ) ; if ( ( $ response = $ dispatcher -> signal ( 'kernel.route' , [ 'resolve... | Real run application |
230,512 | public function getWidth ( ) : int { if ( ! $ this -> loadImageInfo ( ) ) { throw InvalidOperationException :: format ( 'Invalid call to %s: file \'%s\' is not a valid image' , __METHOD__ , $ this -> fullPath ) ; } return $ this -> width ; } | Gets the image width in pixels . |
230,513 | public function getHeight ( ) : int { if ( ! $ this -> loadImageInfo ( ) ) { throw InvalidOperationException :: format ( 'Invalid call to %s: file \'%s\' is not a valid image' , __METHOD__ , $ this -> fullPath ) ; } return $ this -> height ; } | Gets the image height in pixels . |
230,514 | public static function createImageSetFromPostValues ( $ postValues ) { if ( isset ( $ postValues [ 'title' ] , $ postValues [ 'width' ] , $ postValues [ 'height' ] , $ postValues [ 'method' ] ) ) { $ imageSetObject = new \ stdClass ( ) ; $ imageSetObject -> title = $ postValues [ 'title' ] ; $ imageSetObject -> slug = ... | Ceate image set from post values |
230,515 | public function isUpdateAvailable ( $ user , $ version_key , $ schema_version ) { $ user_fields_version = $ this -> getSetting ( $ version_key , 'user_internal' , $ user ) ; if ( ! $ user_fields_version ) { $ user_fields_version = 0 ; } if ( $ user_fields_version < $ schema_version ) { return true ; } return false ; } | Returns true if there is a update of the user fields |
230,516 | public function loadSettingDefaults ( array $ fields , $ user ) { $ user = $ this -> container -> get ( 'security.context' ) -> getToken ( ) -> getUser ( ) ; foreach ( $ fields as $ field ) { if ( ! $ this -> getSetting ( $ field [ 'setting_key' ] , $ field [ 'focus' ] , $ user ) ) { if ( ! isset ( $ field [ 'default_v... | Loading of settings needed for the app Called if it s the first time or user need update of settings |
230,517 | public function loadObjectSettingsDefaults ( $ object_id ) { $ em = $ this -> getEntityManager ( ) ; $ object = $ em -> getRepository ( 'ACSACSPanelBundle:Service' ) -> find ( $ object_id ) ; $ object_fields = $ object -> getType ( ) -> getFieldTypes ( ) ; return $ object_fields ; } | Create the settings configured for specified object |
230,518 | public function getSetting ( $ setting_key , $ focus = null , $ user = null ) { $ params = array ( ) ; $ params [ 'setting_key' ] = $ setting_key ; if ( $ focus ) { $ params [ 'focus' ] = $ focus ; } if ( $ user ) { $ params [ 'user' ] = $ user ; } $ setting = $ this -> findOneBy ( $ params ) ; if ( $ setting ) { retur... | Get setting by parameters |
230,519 | public function setSetting ( $ setting_key , $ focus , $ value , $ context = '' , $ user = null ) { $ em = $ this -> getEntityManager ( ) ; $ params = array ( ) ; $ params [ 'setting_key' ] = $ setting_key ; $ params [ 'focus' ] = $ focus ; if ( $ context ) { $ params [ 'context' ] = $ context ; } if ( $ user ) { $ par... | Sets a setting value |
230,520 | public function getContexts ( $ user ) { $ em = $ this -> getEntityManager ( ) ; $ contexts_rep = $ em -> getRepository ( 'ACSACSPanelBundle:PanelSetting' ) ; $ query = $ contexts_rep -> createQueryBuilder ( 'ps' ) -> select ( 'ps.context' ) -> where ( 'ps.user = ?1' ) -> andWhere ( 'ps.context NOT LIKE ?2' ) -> andWhe... | Returns the context used to organize the settings view |
230,521 | function loadUserFields ( ) { $ user_fields = array ( ) ; $ this -> container -> get ( 'event_dispatcher' ) -> dispatch ( SettingsEvents :: BEFORE_LOAD_USERFIELDS , new FilterUserFieldsEvent ( $ user_fields , $ this -> container ) ) ; array_merge ( $ user_fields , $ user_fields = $ this -> container -> getParameter ( "... | Load the settings array to pass to form |
230,522 | public function getFilePath ( IFile $ file ) : ? string { if ( $ this -> filePathClosure !== null ) { return \ call_user_func ( $ this -> filePathClosure , $ file ) ; } if ( $ file instanceof ExternalFile ) { return $ file -> getActualPath ( ) ; } return $ file -> getId ( ) !== null ? $ this -> getFileDirectory ( $ fil... | Returns file path in contentFS |
230,523 | public function getAssetPath ( IFile $ file , string $ formatName ) : string { return implode ( '/' , array_filter ( [ Type :: $ folderPrefix [ $ file -> getType ( ) ] . '_' . $ formatName , $ file -> getModelAlias ( ) , mb_substr ( $ file -> getHash ( ) , 0 , $ this -> cacheHashLength ) , $ this -> getAssetName ( $ fi... | Returns path in asset filesystem |
230,524 | public function getAssetName ( IFile $ file ) : string { if ( $ this -> assetNameClosure !== null ) { return \ call_user_func ( $ this -> assetNameClosure , $ file ) ; } return $ file -> getId ( ) . '_' . $ file -> getFullName ( ) ; } | File name in asset directory |
230,525 | public function getFileDirectory ( IFile $ file ) : string { return implode ( DIRECTORY_SEPARATOR , array_filter ( [ $ this -> directory , $ this -> getDirectoryHash ( ( string ) $ file -> getId ( ) ) , ] ) ) ; } | Returns target directory for uploaded file |
230,526 | public function whatYouWantAction ( Request $ request ) { if ( $ this -> container -> getParameter ( 'anime_db.catalog.installed' ) ) { return $ this -> redirect ( $ this -> generateUrl ( 'home' ) ) ; } $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( ) ; if ( $ response -> isNotModified ( $ request ) ) {... | What you want . |
230,527 | public function pow ( $ v , int $ dPlaces = 0 ) : RealNumber { $ d = new RealNumber ( $ v ) ; return new RealNumber ( bcpow ( $ this -> value ( ) , $ d -> value ( ) , $ this -> useDecimalPlaces ( $ dPlaces ) ) ) ; } | Eleva o valor atual pelo expoente indicado . |
230,528 | public function sqrt ( int $ dPlaces = 0 ) : RealNumber { return new RealNumber ( bcsqrt ( $ this -> value ( ) , $ this -> useDecimalPlaces ( $ dPlaces ) ) ) ; } | Retorna a raiz do valor atual pelo operando indicado . |
230,529 | public function add ( $ name , callable $ command , $ default = false ) { $ commandName = strtolower ( $ name ) ; if ( isset ( $ this -> _command [ $ commandName ] ) ) { throw new \ Console \ Exception \ Runtime ( 'Duplicated command.' ) ; } if ( ! is_null ( $ this -> _default ) && $ default ) { throw new \ Console \ E... | Add console command |
230,530 | public function get ( $ command ) { return isset ( $ this -> _commands [ $ command ] ) ? $ this -> _commands [ $ command ] : null ; } | Get command callback |
230,531 | public function move ( $ directory ) { if ( false === is_string ( $ directory ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ directory ) ) , E_USER_ERROR ) ; } if ( false === is_dir ( $ directory ) ) { return trigger_error ( sprintf (... | Move the current directory to a new directory including its content |
230,532 | public function delete ( ) { if ( false !== $ this -> directory -> getExists ( ) ) { if ( rmdir ( $ this -> directory -> getBasepath ( ) ) ) { $ this -> refresh ( ) ; } } return $ this ; } | Delete the current directory |
230,533 | public function copy ( $ directory ) { if ( false === is_dir ( $ directory ) ) { return trigger_error ( sprintf ( 'Directory "%s" passed to %s is not an existing directory' , $ directory , __METHOD__ ) , E_USER_ERROR ) ; } if ( false === is_writable ( $ directory ) ) { return trigger_error ( sprintf ( 'Directory "%s" p... | Copy the current directory contents to a new directory including its content |
230,534 | public function rename ( $ name ) { if ( false === is_string ( $ name ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ name ) ) , E_USER_ERROR ) ; } if ( false !== $ this -> directory -> getExists ( ) ) { if ( rename ( $ this -> directo... | Rename the current directory |
230,535 | public function getContent ( $ type = 'default' ) { if ( false === is_string ( $ type ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ type ) ) , E_USER_ERROR ) ; } if ( false === is_dir ( $ this -> directory -> getPath ( ) ) ) { return... | Returns files and folders about the current directory |
230,536 | public function chmod ( $ type ) { if ( false !== $ this -> directory -> getExists ( ) ) { return chmod ( $ this -> directory -> getPath ( ) , $ type ) ; } return false ; } | Returns true if current directory has successfully changed file mode otherwise false |
230,537 | public function chown ( $ username ) { if ( false === is_string ( $ username ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ username ) ) , E_USER_ERROR ) ; } if ( false !== $ this -> directory -> getExists ( ) ) { return chown ( $ thi... | Returns true if current directory has successfully changed owner otherwise false |
230,538 | public function isReadable ( ) { if ( false !== $ this -> directory -> getExists ( ) ) { $ this -> refresh ( ) ; return $ this -> directory -> getReadable ( ) ; } return false ; } | Returns boolean if the current directory is readable |
230,539 | public function isWritable ( ) { if ( false !== $ this -> directory -> getExists ( ) ) { $ this -> refresh ( ) ; return $ this -> directory -> getWritable ( ) ; } return false ; } | Returns boolean if the current directory is writable |
230,540 | public function refresh ( ) { $ directory = new Directory ( $ this -> directory -> getPath ( ) ) ; $ this -> directory = $ directory -> entity ( ) ; return $ this ; } | Drop old and create new directory entity to update information about current directory |
230,541 | private function rcopy ( $ source , $ destination ) { if ( false === is_string ( $ source ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ source ) ) , E_USER_ERROR ) ; } if ( false === is_string ( $ destination ) ) { return trigger_err... | Copy all contens of directory to an existing directory |
230,542 | public function toArray ( $ set = [ ] , $ convert = true ) { $ methods = get_class_methods ( $ this ) ; $ array = [ ] ; if ( true === is_string ( $ set ) ) { $ set = [ $ set ] ; } $ set = array_flip ( $ set ) ; $ amount = count ( $ set ) ; foreach ( $ methods as $ method ) { $ chunks = explode ( 'get' , $ method ) ; if... | Converts all getters to an Array |
230,543 | public function now ( $ format = null ) { $ date = $ this -> currentDate ? clone $ this -> currentDate : ( $ this -> currentDate = new \ DateTime ( ) ) ; return empty ( $ format ) ? $ date : $ date -> format ( $ format ) ; } | return current date |
230,544 | public function cmdUpdateCurrency ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ this -> setSubmitted ( null , $ params ) ; $ this -> setSubmitted ( 'update' , $ params [ 0 ] ) ; $ this -> valida... | Callback for currency - update |
230,545 | public function cmdGetCurrency ( ) { $ list = $ this -> getListCurrency ( ) ; $ this -> outputFormat ( $ list ) ; $ this -> outputFormatTableCurrency ( $ list ) ; $ this -> output ( ) ; } | Callback for currency - get command |
230,546 | public function cmdDeleteCurrency ( ) { $ id = $ this -> getParam ( 0 ) ; $ all = $ this -> getParam ( 'all' ) ; if ( empty ( $ id ) && empty ( $ all ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } $ result = false ; if ( ! empty ( $ id ) ) { $ result = $ this -> currency -> delete ( $ id ) ; ... | Callback for currency - delete command |
230,547 | protected function outputFormatTableCurrency ( array $ items ) { $ header = array ( $ this -> text ( 'Code' ) , $ this -> text ( 'Name' ) , $ this -> text ( 'Symbol' ) , $ this -> text ( 'Conversion rate' ) , $ this -> text ( 'In database' ) , $ this -> text ( 'Enabled' ) ) ; $ rows = array ( ) ; foreach ( $ items as $... | Output formatted table |
230,548 | protected function submitAddCurrency ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'currency' ) ; $ this -> addCurrency ( ) ; } | Add a currency at once |
230,549 | protected function wizardAddCurrency ( ) { $ this -> validatePrompt ( 'code' , $ this -> text ( 'Code' ) , 'currency' ) ; $ this -> validatePrompt ( 'name' , $ this -> text ( 'Name' ) , 'currency' ) ; $ this -> validatePrompt ( 'symbol' , $ this -> text ( 'Symbol' ) , 'currency' ) ; $ this -> validatePrompt ( 'major_un... | Adds a currency step by step |
230,550 | protected function init ( ) { $ handle = curl_init ( ) ; $ this -> handle = $ handle ; $ this -> setSerializer ( new DefaultSerializer ( ) ) ; $ this -> scheme = self :: SCHEME_PLAIN ; $ this -> httpOptions = array ( ) ; $ this -> httpOptions [ CURLOPT_RETURNTRANSFER ] = true ; $ this -> httpOptions [ CURLOPT_FOLLOWLOC... | initialize default values |
230,551 | protected function setHost ( $ host , $ port = null ) { $ this -> host = $ host ; if ( $ port !== null ) { if ( is_numeric ( $ port ) ) { $ this -> port = ( int ) $ port ; } else { throw new ConfigurationException ( "Port '{$port}' is not numeric" ) ; } } } | Sets hostname and optional port |
230,552 | public function performRequest ( $ method , $ uri , $ params = null , $ body = null ) { try { if ( $ body !== null ) { $ body = $ this -> getSerializer ( ) -> serialize ( $ body ) ; } return $ this -> processRequest ( $ method , $ uri , $ params , $ body ) ; } catch ( ClientErrorResponseException $ exception ) { throw ... | performs the request |
230,553 | public function get ( $ uri , $ params = null , $ body = null ) { return $ this -> performRequest ( "get" , $ uri , $ params , $ body ) ; } | perform a get request |
230,554 | public function put ( $ uri , $ params = null , $ body = null ) { return $ this -> performRequest ( "put" , $ uri , $ params , $ body ) ; } | perform a put request |
230,555 | public function post ( $ uri , $ params = null , $ body = null ) { return $ this -> performRequest ( "post" , $ uri , $ params , $ body ) ; } | perform a post request |
230,556 | public function patch ( $ uri , $ params = null , $ body = null ) { return $ this -> performRequest ( "patch" , $ uri , $ params , $ body ) ; } | perform a patch |
230,557 | public function head ( $ uri , $ params = null , $ body = null ) { return $ this -> performRequest ( "head" , $ uri , $ params , $ body ) ; } | perform a head request |
230,558 | public function delete ( $ uri , $ params = null , $ body = null ) { return $ this -> performRequest ( "delete" , $ uri , $ params , $ body ) ; } | perform a delete request |
230,559 | protected function processRequest ( $ method , $ uri , $ params = null , $ body = null ) { $ methodString = $ this -> getMethod ( $ method ) ; if ( method_exists ( $ this , $ methodString ) ) { return $ this -> $ methodString ( $ method , $ uri , $ params , $ body ) ; } else { throw new InvalidRequestMethodException ( ... | precess the request |
230,560 | protected function getRequest ( $ method , $ uri , $ params , $ body ) { return $ this -> execute ( $ method , $ uri , $ params , $ body ) ; } | get request implementation |
230,561 | protected function deleteRequest ( $ method , $ uri , $ params , $ body ) { return $ this -> execute ( $ method , $ uri , $ params , $ body ) ; } | delete request implementation |
230,562 | protected function headRequest ( $ method , $ uri , $ params , $ body ) { return $ this -> execute ( $ method , $ uri , $ params , $ body ) ; } | head request implementation |
230,563 | protected function postRequest ( $ method , $ uri , $ params , $ body ) { return $ this -> execute ( $ method , $ uri , $ params , $ body ) ; } | post request implementation |
230,564 | protected function putRequest ( $ method , $ uri , $ params , $ body ) { $ this -> checkBody ( $ body , $ method ) ; $ this -> setHttpHeader ( 'Content-Length: ' . strlen ( $ body ) ) ; return $ this -> execute ( $ method , $ uri , $ params , $ body ) ; } | put request implementation |
230,565 | protected function prepareResponse ( $ result ) { $ this -> checkForCurlErrors ( ) ; $ response = array ( ) ; $ response [ "data" ] = $ this -> getSerializer ( ) -> deserialize ( $ result ) ; $ response [ "status" ] = $ this -> getStatusCode ( ) ; if ( $ response [ 'status' ] >= 400 && $ response [ 'status' ] < 500 ) {... | prepares the response |
230,566 | protected function checkForCurlErrors ( ) { if ( curl_errno ( $ this -> getHandle ( ) ) ) { $ exceptionText = "Connection Error: " . curl_error ( $ this -> getHandle ( ) ) ; throw new ConnectionException ( $ exceptionText ) ; } } | checks if a curl error occurred |
230,567 | public function enableSSL ( $ strict = false ) { $ this -> setScheme ( self :: SCHEME_SSL ) ; if ( $ strict === false ) { $ this -> setOption ( CURLOPT_SSL_VERIFYPEER , 0 ) ; $ this -> setOption ( CURLOPT_SSL_VERIFYHOST , 0 ) ; } else { $ this -> setOption ( CURLOPT_SSL_VERIFYPEER , 0 ) ; $ this -> setOption ( CURLOPT_... | Enables ssl for the connection |
230,568 | protected function buildUrl ( $ uri , $ params ) { $ host = $ this -> buildHostString ( ) ; if ( strpos ( $ uri , "/" ) !== 0 ) { $ uri = "/" . $ uri ; } $ url = $ host . $ uri ; if ( $ params === null ) { $ params = array ( ) ; } $ url .= $ this -> buildQueryString ( $ params ) ; return $ url ; } | build complete url |
230,569 | protected function buildQueryString ( array $ params ) { $ qs = "" ; foreach ( $ params as $ key => $ value ) { if ( $ qs === "" ) { $ qs = "?" ; } else { $ qs .= "&&" ; } $ qs .= $ key . "=" . $ value ; } return $ qs ; } | build the query string |
230,570 | protected function prepareHost ( $ scheme , $ host ) { $ host = $ this -> stripScheme ( $ host ) ; if ( substr ( $ host , - 1 ) === "/" ) { $ host = substr ( $ host , 0 , - 1 ) ; } return $ scheme . $ host ; } | Adds given scheme to hostname |
230,571 | public function setHttpHeader ( $ header ) { $ headers = $ this -> getHttpHeaders ( ) ; $ headers [ ] = $ header ; $ this -> setHttpHeaders ( $ headers ) ; } | Adds a new http header to header list |
230,572 | function Html ( ) { $ text = $ this -> html ; $ pos = strpos ( $ text , self :: $ placeholder ) ; $ phLength = strlen ( self :: $ placeholder ) ; while ( $ pos !== false && $ this -> currentChild ) { $ replacement = $ this -> RenderCurrentChild ( ) ; $ text = substr ( $ text , 0 , $ pos ) . $ replacement . substr ( $ t... | Gathers the html |
230,573 | protected function buildRunnable ( StdClass $ runnable ) { $ template = __DIR__ . '/template' . '/RunnableTemplate.phx' ; if ( ! file_exists ( $ template ) ) { $ this -> cmd -> error ( sprinf ( 'Template file [%s] does not exist' , $ template ) , 'red' ) ; exit ; } $ content = file_get_contents ( $ template ) ; $ hasLa... | Creates a new runnable object . |
230,574 | protected function validateArgumentLengthType ( String $ argument ) { if ( ! is_numeric ( $ argument ) && ! in_array ( $ argument , [ 'none' , 'i' ] ) ) { $ this -> cmd -> error ( sprintf ( 'Failed to create runnable. [%s] is not a valid argument length type.' , $ argument ) ) ; } if ( in_array ( $ argument , [ 'none' ... | Checks and validates the argument type returned . |
230,575 | public function find ( Request $ request ) { $ route = $ this -> getRouteFinder ( ) -> find ( $ request , $ this -> getRoutes ( ) ) ; $ this -> setCurrentRoute ( $ route ) ; return $ route ; } | Finds a route from a uri . |
230,576 | public function getAllowedIdps ( $ spEntityId ) { if ( isset ( $ this -> allowedIdpsPerSp [ $ spEntityId ] ) ) { return $ this -> allowedIdpsPerSp [ $ spEntityId ] ; } $ this -> allowedIdpsPerSp [ $ spEntityId ] = $ this -> client -> getAllowedIdps ( $ spEntityId ) ; return $ this -> allowedIdpsPerSp [ $ spEntityId ] ;... | Retrieve the allowed IDPs for an SP . The SP is only allowed to make connections to the retrieved IDP s . |
230,577 | public function getEntity ( $ entityId ) { if ( isset ( $ this -> entities [ $ entityId ] ) ) { return $ this -> entities [ $ entityId ] ; } $ this -> entities [ $ entityId ] = $ this -> client -> getEntity ( $ entityId ) ; return $ this -> entities [ $ entityId ] ; } | Get full information for a given entity . |
230,578 | public function getIdpList ( $ keys = array ( ) , $ forSpEntityId = null ) { sort ( $ keys ) ; $ keysString = implode ( ',' , $ keys ) ; if ( isset ( $ this -> identityProvidersMetadata [ $ keysString ] [ $ forSpEntityId ] ) ) { return $ this -> identityProvidersMetadata [ $ keysString ] [ $ forSpEntityId ] ; } if ( ! ... | Retrieve a list of metadata values of all available IDP entities . |
230,579 | public function getSpList ( $ keys = array ( ) ) { sort ( $ keys ) ; $ keysString = implode ( ',' , $ keys ) ; if ( isset ( $ this -> serviceProvidersMetadata [ $ keysString ] ) ) { return $ this -> serviceProvidersMetadata [ $ keysString ] ; } $ this -> serviceProvidersMetadata [ $ keysString ] = $ this -> client -> g... | Retrieve a list of metadata values of all available SP entities . |
230,580 | static public function elapsed ( $ start , $ end ) { return [ 'time_elapsed' => self :: elapsedTime ( $ start , $ end ) , 'memory_usage_gap' => self :: elapsedMemory ( $ start , $ end ) , 'real_memory_usage' => self :: elapsedMemory ( $ start , $ end , true ) ] ; } | Get detailed benchmark |
230,581 | static public function elapsedMemory ( $ start , $ end , $ real_usage = false , $ inMB = true ) { $ start = isset ( self :: $ _marks [ $ start ] ) ? self :: $ _marks [ $ start ] [ 'memory_usage' ] : 0 ; $ end = isset ( self :: $ _marks [ $ end ] ) ? self :: $ _marks [ $ end ] [ 'memory_usage' ] : 0 ; $ elapsed = ! $ re... | Get elapsed memory between two marks |
230,582 | static public function elapsedTime ( $ start , $ end ) { $ start = isset ( self :: $ _marks [ $ start ] ) ? self :: $ _marks [ $ start ] [ 'time' ] : 0 ; $ end = isset ( self :: $ _marks [ $ end ] ) ? self :: $ _marks [ $ end ] [ 'time' ] : 0 ; return $ start ? round ( $ end - $ start , 10 ) : null ; } | Compute the elapsed time of two marks |
230,583 | public function field ( $ fieldnames ) { $ fieldnames = func_get_args ( ) ; foreach ( $ fieldnames as $ fieldname ) { if ( false === is_string ( $ fieldname ) ) { return trigger_error ( sprintf ( 'All fieldnames used in "%s"() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ fieldname ) ) , E_USER_ERR... | Add one or multiple validation rules to one or multiple fields |
230,584 | public function required ( $ required = null ) { if ( false === is_bool ( $ required ) && null !== $ required ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type boolean, "%s" given' , __METHOD__ , gettype ( $ required ) ) , E_USER_ERROR ) ; } if ( null === $ required ) { $ required = tr... | Set a rule that a field value can be empty or not |
230,585 | public function load ( $ classname , $ name = null ) { if ( false === is_string ( $ classname ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ classname ) ) , E_USER_ERROR ) ; } if ( null !== $ name && false === is_string ( $ name ) ) {... | Loads a custom validator rule with optional validator name |
230,586 | public function extend ( $ fields , $ closure , $ message ) { if ( false === is_array ( $ fields ) ) { $ fields = [ ( string ) $ fields ] ; } if ( false === ( gettype ( $ closure ) === 'object' ) ) { return trigger_error ( sprintf ( 'Argument 2 passed to %s() must be a valid callback function, "%s" given' , __METHOD__ ... | Add custom validation rule to one or multiple fields |
230,587 | public function getMessages ( $ fullnames = false ) { if ( false === is_bool ( $ fullnames ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type boolean, "%s" given' , __METHOD__ , gettype ( $ fullnames ) ) , E_USER_ERROR ) ; } $ instance = $ this -> getMessageInstance ( ) ; return $ ins... | Returns all the messages |
230,588 | public function getMessage ( $ fieldname ) { if ( false === is_string ( $ fieldname ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ fieldname ) ) , E_USER_ERROR ) ; } $ instance = $ this -> getMessageInstance ( ) ; $ short = $ instance... | Returns messages by fieldname |
230,589 | public function setPrefix ( $ prefix = null ) { if ( null !== $ prefix ) { if ( false === is_string ( $ prefix ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ prefix ) ) , E_USER_ERROR ) ; } $ this -> prefix = $ prefix ; } return $ thi... | Sets the prefix |
230,590 | private function addRule ( $ rule , $ field , $ parameters , $ closue = null , $ message = null ) { $ this -> rules [ ] = ( object ) [ 'rule' => $ rule , 'field' => $ field , 'parameters' => $ parameters , 'closure' => $ closue , 'prefix' => $ this -> getPrefix ( ) , 'message' => $ message , 'required' => true ] ; } | Add rule to validation |
230,591 | public function setAccessTokenType ( $ type , $ secret = null , $ algorithm = null ) { $ this -> access_token_type = $ type ; $ this -> access_token_secret = $ secret ; $ this -> access_token_algorithm = $ algorithm ; } | Set the access token type |
230,592 | private function generateMACSignature ( $ url , $ parameters , $ http_method ) { $ timestamp = time ( ) ; $ nonce = uniqid ( ) ; $ parsed_url = parse_url ( $ url ) ; if ( ! isset ( $ parsed_url [ 'port' ] ) ) { $ parsed_url [ 'port' ] = ( $ parsed_url [ 'scheme' ] == 'https' ) ? 443 : 80 ; } if ( $ http_method == self ... | Generate the MAC signature |
230,593 | private function convertToCamelCase ( $ grant_type ) { $ parts = explode ( '_' , $ grant_type ) ; array_walk ( $ parts , function ( & $ item ) { $ item = ucfirst ( $ item ) ; } ) ; return implode ( '' , $ parts ) ; } | Converts the class name to camel case |
230,594 | public function isLocked ( $ recover = true ) { $ myPid = getmypid ( ) ; if ( ! file_exists ( $ this -> pidFile ) ) { return false ; } $ lockPid = trim ( file_get_contents ( $ this -> pidFile ) ) ; if ( $ myPid == $ lockPid ) { return false ; } $ isRunning = $ this -> isProcessRunning ( $ lockPid ) ; if ( ! $ isRunning... | Check if this lockFile corresponds to a locked process |
230,595 | public function isProcessRunning ( $ pid ) { if ( ! $ pid ) { return false ; } $ running = posix_kill ( $ pid , 0 ) ; if ( ! $ running ) { return false ; } $ psExists = ! ( bool ) posix_get_last_error ( ) ; return $ psExists ; } | Check if a pid is running |
230,596 | public function getRunningPID ( ) { if ( ! file_exists ( $ this -> pidFile ) ) { return false ; } $ runPid = trim ( file_get_contents ( $ this -> pidFile ) ) ; if ( ! $ runPid ) { return false ; } return $ runPid ; } | Get agent pid |
230,597 | static public function guessByMimeType ( $ mimeType ) { switch ( substr ( $ mimeType , 0 , strpos ( $ mimeType , '/' ) ) ) { case 'audio' : return self :: AUDIO ; break ; case 'image' : return self :: IMAGE ; break ; case 'video' : return self :: VIDEO ; break ; } if ( preg_match ( '~zip|rar|compress~' , $ mimeType ) )... | Guess the type by mime type . |
230,598 | public function insertProtect ( array $ matches = [ ] ) { $ gen = md5 ( mt_rand ( ) ) ; $ s = ( new SessionInjector ) -> build ( ) ; $ s -> csrf = array_merge ( is_array ( $ s -> csrf ) ? $ s -> csrf : [ ] , [ md5 ( $ gen ) ] ) ; return $ matches [ 1 ] . '<input type="hidden" name="csrf" value="' . $ gen . '" />' . $ m... | Insert CSRF protect into forms |
230,599 | public static function pop ( string & $ str , string $ encoding = null ) { $ encoding = $ encoding ? : mb_internal_encoding ( ) ; $ last = mb_substr ( $ str , - 1 , null , $ encoding ) ; $ str = mb_substr ( $ str , 0 , - 1 , $ encoding ) ; return $ last ; } | Pop the character off the end of string |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.