idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
14,800 | public function socialLink ( $ provider , $ providerKey , $ userid = null ) { $ this -> debug -> groupCollapsed ( __METHOD__ ) ; if ( $ userid === null ) { $ userid = $ this -> userid ; } $ vals = array ( 'userid' => $ userid , 'provider' => strtolower ( $ provider ) , 'providerkey' => $ providerKey , ) ; $ where = arr... | Link user to a authentication provider |
14,801 | public function socialUnlink ( $ provider , $ userid = null ) { $ this -> debug -> groupCollapsed ( __METHOD__ ) ; if ( $ userid === null ) { $ userid = $ this -> userid ; } $ where = array ( 'userid' => $ userid , 'provider' => strtolower ( $ provider ) , ) ; $ this -> db -> rowMan ( 'user_social' , null , $ where ) ;... | unlink user from authentication provider |
14,802 | public function verifyEmailToken ( $ token ) { $ this -> debug -> groupCollapsed ( __METHOD__ ) ; $ return = false ; $ token = base64_decode ( $ token ) ; $ vals = array ( 'token_hash' => $ this -> db -> quoteValue ( sha1 ( $ token ) ) , ) ; $ query = Str :: quickTemp ( 'SELECT * FROM `email_tokens` WHERE `token_hash... | verifies a token sent via email searches for token in db if found will remove from db |
14,803 | private function genToken ( $ tokenLen = null ) { $ this -> debug -> groupCollapsed ( __METHOD__ ) ; $ tokenLen = isset ( $ tokenLen ) ? $ tokenLen : $ this -> cfg [ 'tokenLen' ] ; $ token = '' ; if ( function_exists ( 'mcrypt_create_iv' ) && ! defined ( 'PHALANGER' ) ) { $ token = mcrypt_create_iv ( $ tokenLen , MCRYP... | generate crypto strength token |
14,804 | private function hashPassword ( $ pwClear ) { $ this -> debug -> groupCollapsed ( __METHOD__ ) ; $ this -> debug -> time ( 'hash' ) ; $ hash = password_hash ( $ pwClear , $ this -> cfg [ 'passwordHashAlgo' ] , $ this -> cfg [ 'passwordHashOptions' ] ) ; $ this -> debug -> log ( 'hash' , strlen ( $ hash ) , $ hash ) ; $... | returns hashed password |
14,805 | private function resume ( ) { $ this -> debug -> groupCollapsed ( __METHOD__ ) ; if ( isset ( $ _SESSION ) ) { $ this -> user = ArrayUtil :: pathGet ( $ _SESSION , $ this -> cfg [ 'sessionPath' ] ) ; } if ( ! empty ( $ this -> user ) ) { $ this -> debug -> info ( 'resuming from session' ) ; if ( isset ( $ this -> user ... | attempts to load user data from session or via persistant login cookie |
14,806 | public function lastInsertId ( $ name = null ) { if ( is_null ( $ name ) ) { throw new \ Exception ( 'Postgres requires a sequence name to get the last insert ID' ) ; } $ primary_key = $ this -> getPrimaryKey ( $ name ) ; $ id = $ this -> pdo -> lastInsertId ( $ name . '_' . $ primary_key . '_seq' ) ; if ( $ id === fal... | Wrappers for some useful PDO functions |
14,807 | public static function toLeftFoldable ( $ input ) { Arguments :: define ( Boa :: leftFoldable ( ) ) -> check ( $ input ) ; if ( $ input instanceof LeftFoldableInterface ) { return $ input ; } if ( is_array ( $ input ) || $ input instanceof ArrayObject ) { return static :: toList ( $ input ) ; } if ( $ input instanceof ... | Wrap the provided value inside a LeftFoldable . |
14,808 | public static function toFunctor ( $ input ) { Arguments :: define ( Boa :: leftFoldable ( ) ) -> check ( $ input ) ; if ( $ input instanceof FunctorInterface ) { return $ input ; } if ( is_array ( $ input ) || $ input instanceof ArrayObject ) { return static :: toList ( $ input ) ; } throw new CoreException ( 'Unable ... | Wrap the provided value inside a Functor . |
14,809 | public static function toList ( $ input ) { Arguments :: define ( Boa :: lst ( ) ) -> check ( $ input ) ; if ( $ input instanceof ListInterface ) { return $ input ; } return ArrayList :: of ( $ input ) ; } | Wrap provided value inside a List . |
14,810 | public static function toFoldable ( $ input ) { Arguments :: define ( Boa :: foldable ( ) ) -> check ( $ input ) ; if ( $ input instanceof FoldableInterface ) { return $ input ; } if ( is_array ( $ input ) || $ input instanceof ArrayObject ) { return static :: toList ( $ input ) ; } throw new CoreException ( 'Unable to... | Wrap provided value inside a Foldable . |
14,811 | public static function toReadMap ( $ input ) { Arguments :: define ( Boa :: readMap ( ) ) -> check ( $ input ) ; if ( $ input instanceof ReadMapInterface ) { return $ input ; } if ( is_array ( $ input ) || $ input instanceof ArrayObject || $ input instanceof ArrayAccess ) { return static :: toMap ( $ input ) ; } if ( $... | Wrap the provided value inside a ReadMap . |
14,812 | public static function toMap ( $ input ) { Arguments :: define ( Boa :: map ( ) ) -> check ( $ input ) ; if ( $ input instanceof MapInterface ) { return $ input ; } if ( is_array ( $ input ) || $ input instanceof ArrayObject ) { return new ArrayMap ( $ input ) ; } if ( $ input instanceof ArrayAccess ) { return new Arra... | Wrap the provided value inside a Map . |
14,813 | protected function clearParams ( ) { $ this -> limit = null ; $ this -> limitStart = false ; $ this -> limitEnd = false ; $ this -> where = null ; $ this -> orderBy = null ; $ this -> groupBy = null ; $ this -> in = null ; $ this -> params = [ ] ; $ this -> joins = [ ] ; $ this -> query = '' ; } | Set params default value |
14,814 | public function match ( $ input ) { if ( $ this -> token instanceof Token ) { if ( $ this -> token -> matches ( $ input ) ) { return true ; } return false ; } if ( $ this -> token === $ input ) { return true ; } return false ; } | Returns true is the given token matches the Condition s token |
14,815 | public function matched ( $ input ) { if ( $ this -> token instanceof Token ) { return $ this -> token -> matched ( $ input ) ; } return $ input ; } | Returns information about the matched token . |
14,816 | public function colorize ( string $ startColor , string $ text , string $ endColor = self :: NORMAL ) : string { if ( $ this -> getEnableColoredOutput ( ) ) { return $ startColor . $ text . $ endColor ; } return $ text ; } | Wrap the text in colors |
14,817 | public static function GetFileNames ( $ dir , $ filters = array ( ) ) { $ filenames = array_diff ( scandir ( $ dir ) , array ( '..' , '.' ) ) ; if ( count ( $ filters > 0 ) ) { $ filenames = self :: FilterArray ( $ filenames , $ filters ) ; } return $ filenames ; } | Get the file paths for the current directory |
14,818 | public static function FilterArray ( $ targetArray , $ valuesToRemove ) { if ( is_array ( $ valuesToRemove ) ) { foreach ( $ valuesToRemove as $ value ) { if ( ( $ key = array_search ( $ value , $ targetArray ) ) !== false ) { unset ( $ targetArray [ $ key ] ) ; } else { } } } else { } return $ targetArray ; } | Filter values out of a given array of values . |
14,819 | public static function GetApplicationRootDir ( ) { return \ Puzzlout \ Framework \ Enums \ ApplicationFolderName :: AppsFolderName . "APP_NAME" . \ Puzzlout \ Framework \ Enums \ ApplicationFolderName :: ViewsFolderName ; } | Get the directory where are stored the current Application views . |
14,820 | public function View ( $ Name , $ SQL ) { if ( is_string ( $ SQL ) ) { $ SQLString = $ SQL ; $ SQL = NULL ; } else { $ SQLString = $ SQL -> GetSelect ( ) ; } $ Result = $ this -> Query ( 'create or replace view ' . $ this -> _DatabasePrefix . $ Name . " as \n" . $ SQLString ) ; if ( ! is_null ( $ SQL ) ) { $ SQL -> Res... | Specifies the name of the view to create or modify . |
14,821 | public function error ( ) { $ errors = $ this -> validator -> errors ( ) ; $ this -> error = empty ( $ errors ) ? : array_pop ( $ errors ) [ 0 ] ; return $ this -> error ; } | Get first validation error if exists . |
14,822 | public function equals ( InputOption $ option ) { return $ option -> getName ( ) === $ this -> getName ( ) && $ option -> getShortcut ( ) === $ this -> getShortcut ( ) && $ option -> getDefault ( ) === $ this -> getDefault ( ) && $ option -> isArray ( ) === $ this -> isArray ( ) && $ option -> isValueRequired ( ) === $... | Checks whether the given option equals this one . |
14,823 | public function getPath ( $ serviceName ) { if ( in_array ( $ serviceName , $ this -> services ) ) { return str_replace ( '_' , '/' , $ serviceName ) ; } else { $ services = implode ( ', ' , $ this -> services ) ; throw new \ Exception ( "Service \"{$serviceName}\" is not one of: {$services}" ) ; } } | Gets the path of a service . |
14,824 | public static function checkConnections ( $ connection_name , $ table , $ check ) { if ( $ check === true ) { $ connections = DB :: connection ( $ connection_name ) -> table ( $ table ) -> get ( ) ; foreach ( $ connections as $ connection ) { $ name = $ connection -> name ; try { $ testConnection = DB :: connection ( $... | checkConnections function . |
14,825 | public static function random_string ( $ length ) { $ key = '' ; $ keys = array_merge ( range ( 0 , 9 ) , range ( 'a' , 'z' ) ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ key .= $ keys [ array_rand ( $ keys ) ] ; } return $ key ; } | random_string function Does what it says on the tin . |
14,826 | public static function fromXml ( \ DOMNodeList $ xml ) { $ value = null ; if ( $ xml -> length > 0 ) { $ value = new \ DateTimeImmutable ( $ xml -> item ( 0 ) -> textContent ) ; } return new static ( $ value ) ; } | Builds a DateTime object from XML . |
14,827 | public function addDatabase ( Database $ database ) { if ( ! $ this -> getDatabases ( ) -> contains ( $ database ) ) { $ database -> setId ( $ this -> getDatabases ( ) -> count ( ) ) ; $ database -> setInstance ( $ this ) ; $ this -> getDatabases ( ) -> add ( $ database ) ; } } | Add database to the list |
14,828 | public function removeDatabase ( Database $ database ) { if ( $ this -> getDatabases ( ) -> contains ( $ database ) ) { $ this -> getDatabases ( ) -> remove ( $ database ) ; } } | Remove database from the list |
14,829 | public function boot ( Application $ app ) { $ app -> get ( '/api.js' , function ( Application $ app ) { return $ app [ 'direct.api' ] -> getApi ( ) ; } ) -> bind ( 'directapi' ) ; $ app -> get ( '/remoting.js' , function ( Application $ app ) { return $ app [ 'direct.api' ] -> getRemoting ( ) ; } ) ; $ app -> post ( '... | Setup the application . |
14,830 | public function execute ( $ sql , array $ parameters = [ ] ) { $ sth = $ this -> prepare ( $ sql ) ; $ sth -> execute ( $ parameters ) ; return $ sth ; } | Prepares and executes a prepared statement |
14,831 | public function trigger ( $ event ) { if ( is_string ( $ event ) ) { $ event = new Event ( $ event ) ; } $ listeners = $ this -> getListeners ( $ event -> name ) ; if ( empty ( $ listeners ) ) { return $ event ; } $ urgency = ksort ( $ listeners , SORT_NUMERIC ) ; $ callbacks = array_reverse ( $ listeners , true ) ; fo... | Triggers an event ; |
14,832 | public function getListeners ( $ eventName = null ) { if ( empty ( $ eventName ) ) return $ this -> listeners ; if ( ! empty ( $ eventName ) && ! isset ( $ this -> listeners [ $ eventName ] ) ) return [ ] ; return $ this -> listeners [ $ eventName ] ; } | Returns the callbacks attached to a specific event ; |
14,833 | protected function propergate ( & $ event , $ callback ) { $ result = call_user_func ( $ callback [ 'callable' ] , $ event , $ callback [ 'params' ] ) ; if ( $ result === false ) { $ event -> stop ( ) ; } if ( $ result !== null ) { $ event -> setResult ( $ result ) ; } } | Propergate the event to all callbacks ; |
14,834 | public function listeners ( $ event_name ) { if ( ! $ this -> have_read_from_file ) { $ this -> readConfigFile ( ) ; } if ( ! isset ( $ this -> listeners [ $ event_name ] ) ) { return [ ] ; } if ( ! $ this -> listeners [ $ event_name ] [ 0 ] ) { array_multisort ( $ this -> listeners [ $ event_name ] [ 1 ] , SORT_NUMERI... | Returns an array of listeners for a single event . They are sorted by priority . |
14,835 | public function removeListener ( $ event_name , callable $ listener ) { if ( ! $ this -> have_read_from_file ) { $ this -> readConfigFile ( ) ; } if ( ! isset ( $ this -> listeners [ $ event_name ] ) ) { return false ; } foreach ( $ this -> listeners [ $ event_name ] [ 2 ] as $ index => $ check ) { if ( $ check === $ l... | Removes a single listener from an event . |
14,836 | public function xml ( $ type = 'dom' ) { $ xml = $ this -> content ; $ type = trim ( strtolower ( $ type ) ) ; switch ( $ type ) { case 'dom' : $ xml = new \ DOMDocument ( ) ; $ xml -> loadXML ( $ this -> content ) ; break ; case 'simple' : $ xml = new \ SimpleXMLElement ( $ this -> content ) ; break ; } return $ xml ;... | Return the xml object of the ressource |
14,837 | public function content ( $ arg = null ) { switch ( $ this -> format ) { case 'json' : if ( ! isset ( $ arg ) ) { $ arg = false ; } return $ this -> json ( $ arg ) ; break ; case 'xml' : if ( ! isset ( $ arg ) ) { $ arg = 'dom' ; } return $ this -> xml ( $ arg ) ; break ; default : return $ this -> getContent ( ) ; bre... | Get the content of the ressource Return a result depending on the type of the resource |
14,838 | public function isActive ( $ requestUri = null ) { $ uri = rawurldecode ( preg_replace ( '/[\\?#].*$/' , '' , ( string ) $ this -> getUri ( ) ) ) ; if ( empty ( $ uri ) || '/' !== $ uri [ 0 ] ) { return false ; } if ( null === $ requestUri ) { if ( null === $ this -> requestUri ) { $ this -> requestUri = $ this -> getS... | Is this menu - item is active? |
14,839 | public function retrieveToken ( $ key ) { $ location = $ this -> _createFileName ( $ key ) ; if ( file_exists ( $ location ) ) { return file_get_contents ( $ location ) ; } return null ; } | Retrieve a token from storage |
14,840 | public function getDescriptor ( ) { if ( null == $ this -> descriptor ) { $ this -> setDescriptor ( EntityDescriptorRegistry :: getInstance ( ) -> getDescriptorFor ( $ this -> getEntityClassName ( ) ) ) ; } return $ this -> descriptor ; } | Get entity descriptor |
14,841 | public function getEntityClassName ( ) { if ( null == $ this -> entityClassName ) { $ this -> setEntityClassName ( get_class ( $ this -> entity ) ) ; } return $ this -> entityClassName ; } | Gets entity class name for this mapper |
14,842 | public static function Tr ( array $ r , array & $ rt ) { $ wm = [ ] ; $ i ; $ j ; for ( $ i = 0 ; $ i < 3 ; $ i ++ ) { for ( $ j = 0 ; $ j < 3 ; $ j ++ ) { $ wm [ $ i ] [ $ j ] = $ r [ $ j ] [ $ i ] ; } } IAU :: Cr ( $ wm , $ rt ) ; return ; } | - - - - - - i a u T r - - - - - - |
14,843 | public function merge ( ) { $ marged = NULL ; foreach ( func_get_args ( ) as $ arg ) { if ( $ marged === null ) { $ marged = $ arg ; } elseif ( gettype ( $ marged ) !== gettype ( $ arg ) ) { $ marged = $ arg ; } elseif ( ! is_array ( $ arg ) ) { $ marged = $ arg ; } else { foreach ( $ arg as $ _key => $ _val ) { if ( i... | merge recursive . |
14,844 | protected function createClass ( ) { $ file = $ this -> getPath ( ) ; if ( $ this -> files -> exists ( $ file ) ) { throw new PresenterExistsException ( ) ; } else { return $ this -> files -> put ( $ file , $ this -> stub -> populateStub ( $ this -> getPopulatedData ( ) ) ) ; } } | Create the Presenter file |
14,845 | protected function createDirectory ( ) { $ dir = $ this -> getDirectory ( ) ; if ( ! $ this -> files -> isDirectory ( $ dir ) ) { $ this -> files -> makeDirectory ( $ dir , 0755 , true ) ; } return $ this ; } | Create the directory that will be used to receive the Presenters |
14,846 | public function setAction ( $ action ) { if ( $ action instanceof \ Closure ) { $ this -> action = $ action ; return $ this ; } $ parts = explode ( '::' , $ action ) ; if ( count ( $ parts ) != 2 ) { throw new \ LengthException ( 'Malformed action string' ) ; } $ this -> validateRoutable ( $ parts [ 0 ] , $ parts [ 1 ]... | Sets the action |
14,847 | public function acceptedVerb ( $ verb ) { if ( isset ( $ this -> verbs [ 0 ] ) && $ this -> verbs [ 0 ] == static :: ANY_METHOD_WILDCARD ) { return true ; } return in_array ( strtoupper ( $ verb ) , $ this -> getVerbs ( ) , true ) ; } | Asserts if http verb is accepted |
14,848 | public function getActionAsClosure ( ) { if ( $ this -> action instanceof \ Closure ) { return $ this -> action ; } return function ( ) { $ action = $ this -> getActionAsCallable ( ) ; return call_user_func_array ( $ action , func_get_args ( ) ) ; } ; } | Forces the action to be returns Closure |
14,849 | public function match ( $ uri ) { if ( preg_match ( $ this -> getParsedPattern ( ) , trim ( $ uri ) , $ matches ) > 0 ) { $ this -> parameters = array_slice ( $ matches , 1 ) ; return true ; } return false ; } | Determines if uri matches with regex . If match return params of uri |
14,850 | public function toUri ( array $ parameters = [ ] ) { $ pattern = $ this -> getPattern ( ) ; $ wildcardsRegexes = $ this -> wildcardsToRegexGroups ( $ matches = $ this -> getPatternWildcards ( ) ) ; $ parameters = array_slice ( $ parameters , 0 , count ( $ wildcardsRegexes ) ) ; $ this -> validateParametersByWildcards (... | Generates the uri from current route |
14,851 | protected function getPatternWildcards ( ) { preg_match_all ( $ this -> wildcardsToRegex ( ) , $ this -> getPattern ( ) , $ matches ) ; return empty ( $ matches [ 0 ] ) ? [ ] : $ matches [ 0 ] ; } | Gets the wildcards of route pattern |
14,852 | public function getAllKeyValues ( ) { $ query = $ this -> _table -> query ( ) ; $ query -> formatResults ( function ( ResultSet $ results ) { return $ results -> map ( function ( $ row ) { if ( $ row [ 'serialized' ] === true ) { $ row [ 'value' ] = unserialize ( $ row [ 'value' ] ) ; } return $ row ; } ) ; } ) ; $ set... | Returns all keys and their values for all scopes . |
14,853 | public function getKeyValues ( Entity $ entity , array $ keys ) { $ scope = $ this -> config ( 'scope' ) ; $ query = $ this -> _table -> query ( ) ; $ query -> where ( [ 'scope' => $ scope , $ this -> config ( 'fields.key' ) . ' IN' => $ keys ] ) -> hydrate ( false ) ; $ query -> formatResults ( function ( ResultSet $ ... | Generate a custom entity with all keys as properties and their corresponding values |
14,854 | public function saveKeyValues ( Entity $ entity , array $ keys ) { $ event = $ this -> _table -> dispatchEvent ( 'Model.beforeSaveKeyValues' , compact ( 'entity' ) ) ; if ( $ event -> isStopped ( ) ) { return $ event -> result ; } if ( ! empty ( $ event -> result ) ) { $ entity = $ event -> result ; } $ fields = $ this... | Save key value pairs . |
14,855 | protected function _getFieldToIdMapping ( array $ keys ) { return $ this -> _table -> find ( 'list' , [ 'keyField' => $ this -> config ( 'fields.key' ) , 'valueField' => 'id' ] ) -> where ( [ 'scope' => $ this -> config ( 'scope' ) , $ this -> config ( 'fields.key' ) . ' IN' => $ keys ] ) -> toArray ( ) ; } | Returns an array of existing keys and their corresponding ids |
14,856 | protected static function loadSchema ( ) { if ( ! array_key_exists ( static :: table ( ) , static :: $ _schema ) ) { static :: $ _schema [ static :: table ( ) ] = null ; } if ( static :: $ _schema [ static :: table ( ) ] === null ) { $ result = static :: connection ( ) -> prepare ( "DESCRIBE `" . static :: table ( ) . ... | Used to fetch the tables schema . |
14,857 | public static function find ( $ find , $ value = null ) { if ( $ value === null ) { $ value = $ find ; $ find = static :: $ _primaryKey ; } return static :: select ( ) -> where ( "{$find} = ?" , $ value ) -> fetch ( ) ; } | Returns the first found row . |
14,858 | public function data ( ) { $ data = array ( ) ; foreach ( array_keys ( static :: schema ( ) ) as $ column ) { if ( isset ( $ this -> { $ column } ) ) { $ data [ $ column ] = $ this -> { $ column } ; } } return $ data ; } | Gets the models data . |
14,859 | public function save ( ) { if ( ! $ this -> validates ( ) ) { return false ; } $ this -> runFilters ( 'before' , $ this -> _isNew ? 'create' : 'save' ) ; $ data = static :: data ( ) ; if ( $ this -> _isNew ) { $ result = static :: connection ( ) -> insert ( $ data ) -> into ( static :: table ( ) ) -> exec ( ) ; $ this ... | Saves the model to the database . |
14,860 | public function delete ( ) { $ result = static :: connection ( ) -> delete ( ) -> from ( static :: table ( ) ) -> where ( static :: $ _primaryKey . " = ?" , $ this -> { static :: $ _primaryKey } ) -> limit ( 1 ) -> exec ( ) ; if ( $ result ) { $ this -> runFilters ( 'after' , 'delete' ) ; } return $ result ; } | Deletes the row from the database . |
14,861 | public function __toArray ( ) { $ data = array ( ) ; foreach ( static :: schema ( ) as $ field => $ options ) { $ data [ $ field ] = $ this -> { $ field } ; } return $ data ; } | Returns the models properties in a key = > value array . |
14,862 | function it_matches_identifiers ( ) { $ this -> match ( '123' ) -> shouldReturn ( '123' ) ; $ this -> match ( '3.14' ) -> shouldReturn ( '3.14' ) ; $ this -> match ( '-123' ) -> shouldReturn ( '-123' ) ; } | It matches identifiers . |
14,863 | public static function Gst06a ( $ uta , $ utb , $ tta , $ ttb ) { $ rnpb = [ ] ; $ gst ; IAU :: Pnm06a ( $ tta , $ ttb , $ rnpb ) ; $ gst = IAU :: Gst06 ( $ uta , $ utb , $ tta , $ ttb , $ rnpb ) ; return $ gst ; } | - - - - - - - - - - i a u G s t 0 6 a - - - - - - - - - - |
14,864 | public function setExcludes ( array $ excludes ) : self { $ this -> excludes = \ array_map ( function ( $ value ) { return \ trim ( $ value , '/' ) ; } , $ excludes ) ; return $ this ; } | Exclude paths from finder . |
14,865 | public function setComposerAutoload ( string $ packageName , array $ autoload ) : self { $ this -> reset ( ) ; if ( isset ( $ autoload [ 'psr-0' ] ) ) { $ this -> addPsr0 ( $ packageName , ( array ) $ autoload [ 'psr-0' ] ) ; } if ( isset ( $ autoload [ 'psr-4' ] ) ) { $ this -> addPsr4 ( $ packageName , ( array ) $ au... | Set the composer . json file autoload key values . |
14,866 | public function addPsr0 ( string $ packageName , array $ paths ) : self { $ this -> paths [ 'psr0' ] [ $ packageName ] = $ paths ; return $ this ; } | Add composer psr0 paths . |
14,867 | public function addPsr4 ( string $ packageName , array $ paths ) : self { $ this -> paths [ 'psr4' ] [ $ packageName ] = $ paths ; return $ this ; } | Add composer psr4 paths . |
14,868 | public function addClassmap ( string $ packageName , array $ paths ) : self { $ this -> paths [ 'classmap' ] [ $ packageName ] = $ paths ; return $ this ; } | Add composer classmap paths . |
14,869 | public function find ( ) : self { $ preparedPaths = \ array_unique ( \ array_merge ( $ this -> getPreparedPaths ( ( array ) $ this -> paths [ 'psr0' ] ) , $ this -> getPreparedPaths ( ( array ) $ this -> paths [ 'psr4' ] ) , $ this -> getPreparedPaths ( ( array ) $ this -> paths [ 'classmap' ] ) ) , \ SORT_STRING ) ; $... | Find all the class traits and interface names in a given directory . |
14,870 | public function getAll ( ) : array { return \ array_merge ( $ this -> interfaces , $ this -> traits , $ this -> abstractClasses , $ this -> classes ) ; } | Returns a array of all found classes interface and traits . |
14,871 | private static function getName ( $ key , array $ tokens ) : ? string { $ class = null ; $ tokenCount = \ count ( $ tokens ) ; for ( $ i = $ key ; $ i < $ tokenCount ; $ i ++ ) { if ( \ is_array ( $ tokens [ $ i ] ) ) { if ( $ tokens [ $ i ] [ 0 ] === \ T_STRING ) { $ class .= $ tokens [ $ i ] [ 1 ] ; } elseif ( $ toke... | Find the name in the tokens starting at a given key . |
14,872 | private function getPreparedPaths ( array $ paths ) : array { $ fullPaths = [ ] ; foreach ( $ paths as $ name => $ path ) { if ( \ is_array ( $ path ) ) { foreach ( $ path as $ p ) { $ fullPaths [ ] = \ rtrim ( $ this -> vendorDir . \ DIRECTORY_SEPARATOR . $ name . \ DIRECTORY_SEPARATOR . $ p , '/' ) ; } } else { $ ful... | Prepare psr0 and psr4 to full vendor package paths . |
14,873 | public function infoAction ( Request $ request ) { $ securityContext = $ this -> get ( 'security.context' ) ; $ lines = [ ] ; if ( $ securityContext -> isGranted ( 'ROLE_SUPER_ADMIN' ) ) { $ lines [ ] = [ 'Project:' , $ this -> container -> getParameter ( 'phlexible_gui.project.title' ) . ' ' . $ this -> container -> g... | Return info . |
14,874 | public function setOffset ( $ offset , $ parseHints = Parser :: HINT_NONE ) { $ this -> offset = $ offset ; $ this -> parseHints = $ parseHints ; } | Sets a offset |
14,875 | private function iterateKeyReader ( ) { $ results = $ this -> index -> getKeyReader ( ) -> readKeys ( $ this -> offset , $ this -> direction , $ this -> parseHints ) ; if ( empty ( $ results ) ) { return $ results ; } if ( $ this -> direction == KeyReader :: DIRECTION_BACKWARD ) { $ revertBackwardResults = array ( ) ; ... | Iterates in the index and shifts the offset |
14,876 | private function avoidBackwardDuplicates ( array & $ results ) { if ( $ this -> direction == KeyReader :: DIRECTION_FORWARD || $ this -> offset >= 0 ) { return ; } $ lastResults = $ this -> iterator -> getArrayCopy ( ) ; if ( empty ( $ lastResults ) ) { return ; } $ lastMinimum = end ( $ lastResults ) -> getKey ( ) ; $... | Removes results which were found in the previous iteration . |
14,877 | private function prepareSelectValues ( array $ values ) : array { $ options = [ ] ; foreach ( $ values as $ key => $ value ) { $ options [ ] = [ 'id' => $ key , 'caption' => $ value , ] ; } return $ options ; } | Prepares values to use in filter |
14,878 | public function getDefaultSource ( ) { $ source = i18n :: getData ( ) -> getCountries ( ) ; $ invalid = $ this -> config ( ) -> invalid_countries ; return array_filter ( $ source , function ( $ code ) use ( $ invalid ) { return ! in_array ( $ code , $ invalid ) ; } , ARRAY_FILTER_USE_KEY ) ; } | Answers the default source options for the receiver . |
14,879 | public static function create ( $ year = null , $ month = null , $ day = null , $ hour = null , $ min = null , $ second = null ) { return Carbon :: create ( $ year , $ month , $ day , $ hour , $ min , $ second ) ; } | create new date . |
14,880 | protected function getResult ( $ data ) { if ( is_array ( $ data ) ) { header ( 'content-type: application/json' ) ; return $ this -> cypher -> encode ( json_encode ( $ data ) ) ; } return $ data ; } | Encoding and cypher result |
14,881 | protected function getRequestDataByMethod ( $ method = HttpMethods :: GET ) { switch ( $ method ) { case HttpMethods :: POST : $ postData = array_merge ( $ _GET , $ _POST ) ; return $ postData ? : [ ] ; break ; case HttpMethods :: PUT : case HttpMethods :: PATCH : $ data = $ this -> cypher -> decode ( file_get_contents... | Returns the incoming array of parameters based on the type of the request |
14,882 | protected function getActionArguments ( $ class , $ action ) { $ method = new \ ReflectionMethod ( $ class , $ action ) ; $ this -> action = $ method ; $ parameters = $ method -> getParameters ( ) ; $ result = [ ] ; foreach ( $ parameters as $ parameter ) { $ attribute = new ActionAttribute ( ) ; $ attribute -> name = ... | It goes through the parameters of the method and checks for the default value and requirement |
14,883 | protected function callAction ( ControllerInterface $ class , $ action , $ arguments , array $ data ) { if ( null !== $ this -> action || $ this -> action -> getName ( ) !== $ this -> action ) { $ this -> action = new \ ReflectionMethod ( $ class , $ action ) ; } $ params = [ ] ; $ dataBox = new Param ( $ data ) ; fore... | Calling action with request data in params |
14,884 | protected function getAllowedMethodsForRoute ( ControllerInterface $ class , $ action ) { $ actionsInfo = $ class -> getMethods ( ) ; if ( isset ( $ actionsInfo [ $ action ] ) ) { $ methods = implode ( ', ' , $ actionsInfo [ $ action ] -> getAllowedMethods ( ) ) ; $ methodInfo = ReflectionHelper :: getMethodInfo ( $ cl... | Return action description and set headers to output |
14,885 | public static function typed ( string $ type , iterable $ input = [ ] ) : Queue { $ resolver = Resolver :: typed ( $ type ) ; return new static ( $ input , $ resolver ) ; } | Queue named constructor . |
14,886 | public function getData ( $ segments ) { $ data = new stdClass ; $ data -> errors = array ( ) ; $ data -> email = BRequest :: getString ( 'email' ) ; $ data -> name = BRequest :: getString ( 'name' ) ; $ data -> password = BRequest :: getString ( 'password' ) ; $ data -> result = false ; $ data -> do = BRequest :: getS... | Get Data and try to registar user if need . |
14,887 | public function callback_dismiss_notification ( ) { if ( isset ( $ _POST [ 'namespace' ] ) || isset ( $ _POST [ 'id' ] ) ) { $ namespace = $ _POST [ 'namespace' ] ; $ id = $ _POST [ 'id' ] ; $ n_class = get_class ( ) ; $ notify = new $ n_class ( $ namespace ) ; $ notify -> hide_notification ( $ id ) ; } exit ; } | Callback to handle dismiss button AJAX request |
14,888 | private function load_notices ( ) { $ notices = get_option ( 'wp_easy_notify_' . $ this -> prefix , array ( ) ) ; $ this -> notices = $ notices ; $ active = get_option ( 'wp_easy_notify_active_' . $ this -> prefix , array ( ) ) ; $ this -> active = $ active ; } | Load all notices into the class . |
14,889 | public function display_notices ( ) { foreach ( $ this -> active as $ id => $ count ) { if ( is_callable ( $ this -> notices [ $ id ] [ 'cond_func' ] ) ) { $ cond = call_user_func ( $ this -> notices [ $ id ] [ 'cond_func' ] ) ; } else { $ cond = true ; } if ( $ cond ) { $ this -> print_notification ( $ this -> notices... | Display the notices . |
14,890 | private function print_notification ( $ notice ) { do_action ( 'easy_notifications_before_notice' , $ notice ) ; echo '<div class="updated ' . $ notice [ 'type' ] . '"> ' . $ notice [ 'content' ] . ' <a href="#" class="dismiss-notice" data-namespace="' . $ this -> prefix . '" ... | Print a notification to the current Page . |
14,891 | private function save ( ) { update_option ( 'wp_easy_notify_' . $ this -> prefix , $ this -> notices ) ; update_option ( 'wp_easy_notify_active_' . $ this -> prefix , $ this -> active ) ; } | Save the class data to Database . |
14,892 | public function add_notification ( $ id , $ content , $ type = null , $ hide_button = null , $ cond_func = null ) { if ( isset ( $ this -> notices [ $ id ] ) ) { return false ; } if ( ! $ type ) { $ type = 'success' ; } if ( ! $ hide_button ) { $ hide_button = true ; } if ( ! $ cond_func ) { $ cond_func = false ; } $ t... | Add a notification to the notices namespace . |
14,893 | public function update_notification ( $ id , $ content = null , $ type = null , $ hide_button = null , $ cond_func = null ) { if ( ! isset ( $ this -> notices [ $ id ] ) ) { $ this -> add_notification ( $ id , $ content , $ type , $ hide_button , $ cond_func ) ; } if ( $ content ) { $ this -> notices [ $ id ] [ 'conten... | Update a notification configuration . |
14,894 | public function send ( ) { $ args = func_get_args ( ) ; if ( count ( $ args ) > 1 ) { $ message = call_user_func_array ( 'sprintf' , $ args ) ; } else { $ message = $ args [ 0 ] ; } $ this -> response -> send ( $ message ) ; } | implements for task output . |
14,895 | public function isUsage ( ) { $ options = array ( 'help' , 'usage' , 'option.h' ) ; foreach ( $ options as $ option ) { if ( $ this -> request -> get ( $ option ) ) return true ; } return false ; } | is usage ? |
14,896 | protected function setLanguage ( ) { $ matches = array ( ) ; if ( $ this -> owner -> user -> hasState ( '__locale' ) ) $ language = $ this -> owner -> user -> getState ( '__locale' ) ; else if ( preg_match ( '/^\/([a-z]{2}(?:_[a-z]{2})?)\//i' , substr ( $ this -> owner -> request -> url , strlen ( $ this -> owner -> ba... | Sets the application language from a user state if applicable . |
14,897 | public function getComponentName ( ) { $ component = $ this -> argument ( 'component' ) ? : app ( 'components' ) -> getUsedNow ( ) ; $ component = app ( 'components' ) -> findOrFail ( $ component ) ; return $ component -> getStudlyName ( ) ; } | Get the component name . |
14,898 | protected static function registerDump ( $ representation , $ backtrace ) { $ dump = new Dump ( $ representation , $ backtrace [ 0 ] [ 'file' ] , $ backtrace [ 0 ] [ 'line' ] ) ; static :: $ instances [ ] = $ dump ; return $ dump ; } | Registers a dump . |
14,899 | public function get ( string $ option ) { if ( ! isset ( $ this -> options [ $ option ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Option "%s" does not exists.' , $ option ) ) ; } return $ this -> options [ $ option ] ; } | Returns options value by its name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.