idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
55,000 | function render ( ) { if ( $ this -> show_metainfo ) { $ this -> appendtagbody ( $ this -> hidden ( 'form' ) -> value_is ( $ this -> signature ( ) ) ) ; } return parent :: render ( ) ; } | A form hidden field will be inserted into the form to identify the data submitted belonged to this form . |
55,001 | public function setupCredentials ( array $ credentials ) { if ( ! array_key_exists ( 'key' , $ credentials ) ) { throw new InvalidApplicationKeyException ( ) ; } if ( ! array_key_exists ( 'secret' , $ credentials ) ) { throw new InvalidApplicationSecretKeyException ( ) ; } if ( isset ( $ credentials [ 'redirect_uri' ] ... | Setups provider credentials |
55,002 | public function setAllScopes ( ) { $ scopes = array ( ) ; $ reflectionClass = new \ ReflectionClass ( __CLASS__ ) ; foreach ( $ reflectionClass -> getConstants ( ) as $ constantName => $ constantValue ) { if ( strpos ( $ constantName , 'SCOPE_' ) !== false ) { $ scopes = $ constantValue ; } } $ this -> setScopes ( $ sc... | Sets all permissions which user will be asked for during authentication process |
55,003 | public function addScope ( $ scope ) { if ( ! in_array ( $ scope , $ this -> scopes ) ) { $ this -> scopes [ ] = $ scope ; } return $ this ; } | Adds provider scope |
55,004 | public function isAuthenticated ( ) { try { $ session = $ this -> sessionStorage -> retrieveAccessToken ( $ this -> getServiceName ( ) ) ; if ( ! $ session ) { return false ; } return $ session -> getEndOfLife ( ) > time ( ) ; } catch ( TokenNotFoundException $ e ) { return false ; } } | Obtains authentication for current service |
55,005 | public function getErrorMessage ( bool $ appendPreviousByNewline = false ) : string { $ prev = $ this -> getPrevious ( ) ; if ( \ is_null ( $ prev ) ) { return \ sprintf ( '%s(%d): %s' , static :: GetCodeName ( $ this -> getCode ( ) ) , $ this -> getCode ( ) , $ this -> getMessage ( ) ) ; } $ separator = $ appendPrevio... | Extends the origin getMessage method so also previous messages are include if defined . |
55,006 | public static function GetCodeName ( $ code ) : string { switch ( $ code ) { case \ E_ERROR : case \ E_USER_ERROR : return 'ERROR' ; case \ E_WARNING : case \ E_USER_WARNING : return 'WARNING' ; case \ E_DEPRECATED : case \ E_USER_DEPRECATED : return 'DEPRECATED' ; case \ E_NOTICE : case \ E_USER_NOTICE : return 'NOTIC... | Returns a string representing the defined error code . |
55,007 | private function sendMail ( ) { if ( is_null ( $ this -> mailer ) && ! is_null ( Application :: getInstance ( ) -> getConfig ( ) -> mail -> mailer ) ) { $ mailer = Application :: getInstance ( ) -> getConfig ( ) -> mail -> mailer ; $ reflection = new \ ReflectionClass ( str_replace ( '/' , '\\' , $ mailer -> class ) ) ... | evaluate mailer class and send mail |
55,008 | private function buildHeaders ( ) { $ this -> headers = [ 'From' => $ this -> sender , 'Return-Path' => $ this -> sender , 'Reply-To' => $ this -> sender , 'Date' => ( new \ DateTime ( ) ) -> format ( 'r' ) , 'Message-ID' => '<' . sha1 ( microtime ( ) ) . '@' . substr ( $ this -> sender , strpos ( $ this -> sender , '@... | fill headers array |
55,009 | private function buildMsg ( ) { if ( isset ( $ this -> boundary ) ) { $ this -> msg = '--' . $ this -> boundary . self :: CRLF ; $ this -> msg .= 'Content-type: text/' . ( $ this -> htmlMail ? 'html' : 'plain' ) . '; charset=' . $ this -> encoding . self :: CRLF ; $ this -> msg .= 'Content-Transfer-Encoding: 8bit' . se... | build message body |
55,010 | public function init ( $ config = [ ] ) { $ handlers = array_values ( $ config [ 'handlers' ] ) ; foreach ( $ handlers as $ conf ) { $ class = $ conf [ 'class' ] ; $ handler = new $ class ( $ conf ) ; $ this -> addHandler ( $ handler ) ; } } | Initialises the log . |
55,011 | private function _logIt ( $ level , $ message , $ context = [ ] ) { foreach ( $ this -> _handlers as $ handler ) { $ args [ 'message' ] = $ message ; $ record = $ handler -> createRecord ( $ level , $ args , $ context ) ; $ handler -> handle ( $ record ) ; } } | Logs messages to the log . |
55,012 | public static function getLevelString ( $ level ) { $ name = '' ; switch ( $ level ) { case self :: LEVEL_DEBUG : $ name = 'DEBUG' ; break ; case self :: LEVEL_INFO : $ name = 'INFO' ; break ; case self :: LEVEL_NOTICE : $ name = 'NOTICE' ; break ; case self :: LEVEL_WARNING : $ name = 'WARNING' ; break ; case self :: ... | Returns the level as string . |
55,013 | public function setTokenValidity ( $ tokenValidity ) { $ tknVal = intval ( $ tokenValidity ) ; if ( empty ( $ tknVal ) ) { $ tknVal = self :: BASIC_VALIDITY ; } $ this -> tokenValidity = intval ( $ tknVal ) ; } | Sets token validity |
55,014 | public function hasReadableProperty ( string $ name , & $ getterName ) : bool { if ( \ in_array ( $ name , $ this -> ignoreGetProperties ) ) { return false ; } $ getterName = 'get' . \ ucfirst ( $ name ) ; return \ method_exists ( $ this , $ getterName ) ; } | Returns if a property with the defined name exists for read access . |
55,015 | private function checkUser ( ) { static $ enabled ; if ( ! isset ( $ enabled ) ) { $ token = $ this -> tokenStorage -> getToken ( ) ; if ( $ token ) { $ user = $ token -> getUser ( ) ; if ( $ user instanceof \ FOS \ UserBundle \ Model \ User ) { if ( $ user -> hasRole ( 'ROLE_USER' ) ) $ enabled = $ token -> isAuthenti... | checks if the current User is ROLE_USER |
55,016 | public function getHash ( ) { $ names = array_keys ( $ this -> modules ) ; sort ( $ names ) ; return md5 ( implode ( '|' , $ names ) ) ; } | Get an MD5 hash computed from the sorted type names of all modules . |
55,017 | public function getLastModified ( ) { $ mtime = 0 ; foreach ( $ this -> modules as $ module ) { $ mtime = max ( $ mtime , filemtime ( ( new \ ReflectionClass ( get_class ( $ module ) ) ) -> getFileName ( ) ) ) ; } return $ mtime ; } | Get the time of the most recent modification to any registered module . |
55,018 | private function getIntegerSQLDeclarationSnippet ( array $ options = array ( ) ) { $ length = isset ( $ options [ 'length' ] ) ? ( int ) $ options [ 'length' ] : null ; $ unsigned = isset ( $ options [ 'unsigned' ] ) && $ options [ 'unsigned' ] ? ' UNSIGNED' : null ; $ autoIncrement = isset ( $ options [ 'auto_incremen... | Gets the integer SQL declaration snippet . |
55,019 | private function getStringTypePrefix ( $ length = null ) { if ( $ length === null ) { return 'LONG' ; } if ( ! is_int ( $ length ) || ( $ length <= 0 ) ) { throw PlatformException :: invalidStringTypePrefixLength ( ) ; } $ prefixLimits = array ( 'TINY' => 255 , '' => 65535 , 'MEDIUM' => 16777215 , ) ; $ stringTypePrefi... | Gets the string type prefix for the given length . |
55,020 | public function clearByTag ( CachePoolInterface $ cache , $ tag ) { $ tagKey = $ this -> getTagKey ( $ tag ) ; $ tagItem = $ cache -> getItem ( $ tagKey ) ; if ( $ tagItem -> isHit ( ) ) { $ keyArray = $ tagItem -> get ( ) ; foreach ( array_keys ( $ keyArray ) as $ key ) { if ( $ cache -> deleteItem ( $ key ) ) { unset... | Clear by tags |
55,021 | public function getLoaderInstallPath ( PackageInterface $ package ) { $ config = $ this -> getInstallerConfig ( $ package ) ; $ installPath = 'wp-content/mu-plugins/' ; if ( ! $ this -> composer -> getPackage ( ) ) { return $ this -> parseTemplate ( $ installPath , $ config ) ; } $ extra = $ this -> composer -> getPack... | Gets the install path for the loader script of an MU plugin . |
55,022 | public function getLoaderFilePackagePath ( PackageInterface $ package ) { $ installPath = $ this -> getInstallPath ( $ package ) ; if ( $ installPath === false ) { return false ; } $ config = $ this -> getInstallerConfig ( $ package ) ; $ packagePath = $ installPath . $ config [ 'loader' ] ; return $ packagePath ; } | Gets the file path where a loader script is located . |
55,023 | public function getLoaderFileInstallPath ( PackageInterface $ package ) { $ installPath = $ this -> getLoaderInstallPath ( $ package ) ; if ( $ installPath === false ) { return false ; } $ config = $ this -> getInstallerConfig ( $ package ) ; $ installPath = $ installPath . basename ( $ config [ 'loader' ] ) ; return $... | Gets the file path where a loader script is installed . |
55,024 | protected function getInstallerConfig ( PackageInterface $ package ) { if ( $ this -> installerConfig !== null ) { return $ this -> installerConfig ; } $ type = $ package -> getType ( ) ; $ prettyName = $ package -> getPrettyName ( ) ; if ( strpos ( $ prettyName , '/' ) !== false ) { list ( $ vendor , $ name ) = explod... | Retrieves configuration values from a packages s composer . json . |
55,025 | protected function parseTemplate ( $ template , array $ vars = array ( ) ) { if ( strpos ( $ template , '{' ) === false ) { return $ template ; } if ( preg_match_all ( '@\{\$([A-Za-z0-9_]+)\}@i' , $ template , $ matches ) ) { foreach ( $ matches [ 1 ] as $ varName ) { $ template = str_replace ( '{$' . $ varName . '}' ,... | Parses a template string . |
55,026 | protected function resolveInstallPath ( array $ paths , $ name ) { foreach ( $ paths as $ path => $ names ) { if ( in_array ( $ name , $ names , true ) || in_array ( 'type:' . static :: TYPE , $ names , true ) ) { return $ path ; } } return false ; } | Searches the install path based on a package name and a paths array . |
55,027 | protected function installLoader ( PackageInterface $ package ) { $ source = $ this -> getLoaderFilePackagePath ( $ package ) ; $ target = $ this -> getLoaderFileInstallPath ( $ package ) ; copy ( $ source , $ target ) ; } | Installs the loader script of an MU plugin . |
55,028 | protected function removeLoader ( PackageInterface $ package ) { $ target = $ this -> getLoaderFileInstallPath ( $ package ) ; if ( ! $ this -> filesystem -> remove ( $ target ) ) { throw new \ RuntimeException ( 'Could not completely delete ' . $ target . ', aborting.' ) ; } } | Removes the loader script of an MU plugin . |
55,029 | protected function renderHelper ( $ name , ElementInterface $ element ) { $ helper = $ this -> getView ( ) -> plugin ( $ name ) ; return $ helper ( $ element ) ; } | Render element by helper name |
55,030 | public function getRoutes ( ) : Array { $ return = array ( ) ; foreach ( $ this -> routes as $ route ) { array_push ( $ return , [ $ route -> getPath ( ) , $ route -> getMethod ( ) ] ) ; } return $ return ; } | Return all defined routes with their method |
55,031 | public function get ( String $ path , Callable $ callback ) : Route { return $ this -> collectRoute ( 'GET' , $ path , $ callback ) ; } | Create and collect a new Route with GET request |
55,032 | public function post ( String $ path , Callable $ callback ) : Route { return $ this -> collectRoute ( 'POST' , $ path , $ callback ) ; } | Create and collect a new Route with POST request |
55,033 | public function put ( String $ path , Callable $ callback ) : Route { return $ this -> collectRoute ( 'PUT' , $ path , $ callback ) ; } | Create and collect a new Route with PUT request |
55,034 | public function delete ( String $ path , Callable $ callback ) : Route { return $ this -> collectRoute ( 'DELETE' , $ path , $ callback ) ; } | Create and collect a new Route with DELETE request |
55,035 | public function options ( String $ path , Callable $ callback ) : Route { return $ this -> collectRoute ( 'OPTIONS' , $ path , $ callback ) ; } | Create and collect a new Route with OPTIONS request |
55,036 | public function patch ( String $ path , Callable $ callback ) : Route { return $ this -> collectRoute ( 'PATCH' , $ path , $ callback ) ; } | Create and collect a new Route with PATCH request |
55,037 | public function validateOrFail ( array $ data , $ model = null ) { $ this -> publish ( 'validating' , [ $ this , $ data , $ model ] ) ; $ rules = $ this -> rules ( ) ; $ parsedRules = $ this -> parseRules ( $ rules , $ data , $ model ) ; $ this -> publish ( 'validation-rules.parsed' , [ & $ parsedRules ] ) ; $ validato... | Validate the data . If validation failes throw a exception If a model is passed as the second parameter parse the rules to match the model . If no model is passed considerate it as a new model |
55,038 | protected function getValidatorInstance ( $ rules , $ data , $ model = null ) { $ factory = $ this -> container -> make ( 'Illuminate\Validation\Factory' ) ; if ( method_exists ( $ this , 'validatorInstance' ) ) { return $ this -> container -> call ( [ $ this , 'validatorInstance' ] , compact ( 'factory' ) ) ; } return... | Get the validator instance to perform the actual validation |
55,039 | public function customAttributes ( ) { if ( ! $ form = $ this -> distributor -> form ( null , $ this -> resourceName ( ) ) ) { return [ ] ; } return $ form -> getValidator ( ) -> buildAttributeNames ( $ form ) ; } | Set custom attributes for validator errors . |
55,040 | private function flatten ( array $ choices , callable $ value , & $ choicesByValues , & $ keysByValues , & $ structuredValues ) : void { if ( null === $ choicesByValues ) { $ choicesByValues = [ ] ; $ keysByValues = [ ] ; $ structuredValues = [ ] ; } foreach ( $ choices as $ key => $ choice ) { if ( \ is_array ( $ choi... | Flattens an array into the given output variables . |
55,041 | public function getFacts ( ) { if ( $ this -> facts === null ) { $ this -> setFacts ( $ this -> nodeService -> getNodeFacts ( $ this -> getName ( ) ) ) ; } return $ this -> facts ; } | Get facts . |
55,042 | public function hasFact ( $ name ) { if ( $ this -> hasFacts ( ) && array_key_exists ( $ name , $ this -> facts ) ) { return true ; } return false ; } | Determine if the node has the specified fact . |
55,043 | public function get ( $ path ) { $ entity = null ; $ name = null ; $ subtree = $ this -> subtree ( $ path , $ name ) ; if ( ! is_null ( $ subtree ) && isset ( $ subtree -> _ownData [ $ name ] ) ) { $ entity = $ subtree -> _ownData [ $ name ] ; } return $ entity ; } | Return stream entiry |
55,044 | public function add ( $ path , Entity_Interface $ entity ) { $ result = false ; if ( strlen ( $ path ) ) { $ name = null ; $ subtree = $ this -> subtree ( $ path , $ name , true ) ; $ subtree -> _ownData [ $ name ] = $ entity ; $ result = true ; } return $ result ; } | Add stream entity to changes array |
55,045 | public function delete ( $ path ) { $ result = false ; $ parts = $ this -> split ( $ path ) ; $ name = array_shift ( $ parts ) ; if ( ! sizeof ( $ parts ) ) { if ( isset ( $ this -> _ownData [ $ name ] ) ) { unset ( $ this -> _ownData [ $ name ] ) ; $ result = true ; } } elseif ( isset ( $ this -> _subTrees [ $ name ] ... | Delete stream entity from array |
55,046 | public function own ( $ path = "" ) { if ( $ path ) { $ parts = $ this -> split ( $ path ) ; $ name = array_shift ( $ parts ) ; $ own = array ( ) ; if ( isset ( $ this -> _subTrees [ $ name ] ) ) { $ subtree = $ this -> _subTrees [ $ name ] ; $ this -> _appendChildren ( $ own , $ name , $ subtree -> own ( $ parts ) ) ;... | Return subtree s own changes |
55,047 | private function _appendChildren ( array & $ children , $ name , array $ _children ) { foreach ( $ _children as $ key => $ value ) { $ children [ $ name . "/" . $ key ] = $ value ; } } | Add new children to array |
55,048 | public function subtree ( $ path , & $ name , $ create = false ) { $ parts = $ this -> split ( $ path ) ; $ _name = array_shift ( $ parts ) ; if ( ! sizeof ( $ parts ) ) { $ name = $ _name ; $ subtree = $ this ; } else { $ exists = isset ( $ this -> _subTrees [ $ _name ] ) ; if ( ! $ exists && ! $ create ) { $ subtree ... | Return subtree by path |
55,049 | protected function split ( $ path ) { if ( is_array ( $ path ) ) { $ parts = $ path ; } else { $ parts = explode ( "/" , $ path ) ; } return $ parts ; } | Split path into dir names |
55,050 | public function isUpdated ( $ property = null ) { if ( null === $ property ) { return ( count ( $ this -> updated ) > 0 ) ; } return ( isset ( $ this -> updated [ $ property ] ) && $ this -> updated [ $ property ] === true ) ; } | If at least one data has been updated . If property name is specified check only property . |
55,051 | public function initDependencyContainer ( Dependency \ ContainerInterface $ container = null ) { if ( null === $ container ) { $ container = Dependency \ Container :: getInstance ( ) ; } $ this -> dependencyContainer = $ container ; return $ this ; } | Initialize dependency container . |
55,052 | public function overwrite ( $ key , $ value = null ) { if ( ! is_array ( $ key ) ) { $ this -> overwrittenData [ $ key ] = $ value ; return $ this ; } foreach ( $ key as $ k => $ v ) { $ this -> overwrite ( $ k , $ v ) ; } return $ this ; } | Overwrite one or more view variables |
55,053 | protected function finalRecipients ( $ passedTo ) { if ( ! $ this -> overwrittenTo ) { return $ passedTo ; } $ overwrittenTo = $ this -> overwrittenTo ; $ this -> overwrittenTo = [ ] ; return $ overwrittenTo ; } | Returns only the overwritten recipients or if non set the passed ones |
55,054 | protected function finalView ( $ passedView ) { if ( ! $ this -> overwrittenView ) { return $ passedView ; } $ overwrittenView = $ this -> overwrittenView ; $ this -> overwrittenView = '' ; if ( ! is_array ( $ overwrittenView ) && ! is_array ( $ passedView ) ) { return $ overwrittenView ; } if ( ! is_array ( $ overwrit... | Returns the overwritten view if one set otherwise the passed one |
55,055 | protected function finalData ( $ passedData ) { $ overwrittenData = $ this -> overwrittenData ; $ this -> overwrittenData = [ ] ; foreach ( $ overwrittenData as $ key => $ value ) { $ passedData [ $ key ] = $ value ; } return $ passedData ; } | Merges the passed view data with the assigned one |
55,056 | protected function flushRecipients ( $ closure ) { $ recipients = ( array ) $ this -> temporaryTo ; $ this -> temporaryTo = null ; if ( ! $ recipients && ! is_callable ( $ closure ) ) { throw new BadMethodCallException ( 'Recipient not determinable: Neither a recipient was set by to() nor a callable was passed' ) ; } r... | Returns the recipients and clears em |
55,057 | protected function createBuilder ( array $ recipients , $ data , $ callback ) { $ messageBuilder = new MessageBuilder ( $ recipients , $ data , $ callback ) ; if ( $ developerTo = $ this -> config -> get ( 'mail.overwrite_to' ) ) { $ messageBuilder -> setOverwriteTo ( $ developerTo ) ; } return $ messageBuilder ; } | Create the pseudo closure creator |
55,058 | protected function parseTexts ( array $ data ) { foreach ( $ this -> parseKeys as $ key ) { if ( ! isset ( $ data [ $ key ] ) || ! is_string ( $ data [ $ key ] ) ) { continue ; } $ data [ $ key ] = $ this -> textParser -> parse ( $ data [ $ key ] , $ data ) ; } return $ data ; } | Parse all keys that have to be parsed by text parser |
55,059 | protected function getConnection ( ) { if ( empty ( $ this -> memcache ) ) { $ this -> memcache = new Memcache ; if ( ! is_array ( $ this -> memcachedServers ) || count ( $ this -> memcachedServers ) < 1 ) throw new CacheException ( 'At least one server must be specified.' ) ; foreach ( $ this -> memcachedServers as $ ... | Returns a connection to the memcached server |
55,060 | public function getStats ( ) { if ( ! $ this -> enabled ) return array ( ) ; $ stats = @ $ this -> getConnection ( ) -> getStats ( ) ; $ this -> Logger -> debug ( 'Retrieved Stats' ) ; $ this -> Logger -> debug ( $ stats ) ; return $ stats ; } | Implementation specific array of statistics |
55,061 | public function increment ( $ key , $ step = 1 ) { if ( ! $ this -> enabled ) return false ; $ has_replaced = $ has_set = false ; try { $ nKey = $ this -> key ( $ key ) ; $ has_replaced = @ $ this -> getConnection ( ) -> add ( $ nKey , $ step , 0 ) ; if ( ! $ has_replaced ) { $ has_set = @ $ this -> getConnection ( ) -... | Increment a value in the cache store |
55,062 | public function decrement ( $ key , $ step = 1 ) { if ( ! $ this -> enabled ) return false ; $ has_replaced = $ has_set = false ; try { $ nKey = $ this -> key ( $ key ) ; $ has_set = @ $ this -> getConnection ( ) -> decrement ( $ nKey , $ step ) ; } catch ( Exception $ e ) { throw new CacheException ( $ e -> getMessage... | Decrement a value in the cache store |
55,063 | public function getIncrement ( $ key ) { if ( ! $ this -> enabled ) return false ; return @ $ this -> getConnection ( ) -> get ( $ this -> key ( $ key ) ) ; } | Get incremented value in the cache store |
55,064 | public function add ( $ key , $ data , $ ttl ) { if ( ! $ this -> enabled ) return true ; try { $ data = $ this -> storageFormat ( $ key , $ data , $ ttl ) ; $ nKey = $ this -> key ( $ key ) ; $ ret = @ $ this -> getConnection ( ) -> add ( $ nKey , $ data , $ this -> flags , $ ttl ) ; $ this -> Logger -> debug ( "" . (... | Stores data into the cache store by key with a given timeout in seconds UNLESS an entry already exists under that key . The implementation must support native serialization of objects and arrays so that the caller does not need to serialize manually . |
55,065 | public function route ( ) { $ this -> Logger -> debug ( "Request: {$this->Request->getFullURL()}" ) ; $ uri = $ this -> Request -> getAdjustedRequestURI ( ) ; $ this -> Logger -> debug ( "Routing URI: {$uri}" ) ; $ result = array ( ) ; $ qs = array_merge ( $ _POST , $ _GET ) ; $ routes = $ this -> routeService -> findA... | Returns an array that describes the result of the current route . |
55,066 | public function checkRedirects ( ) { $ uri = strtolower ( rtrim ( $ this -> Request -> getAdjustedRequestURI ( ) , '/' ) ) ; $ qs = $ this -> Request -> getQueryString ( ) ; if ( ( $ previousRedirect = $ this -> TemplateCache -> get ( 'redirect:' . $ uri ) ) !== false ) { $ this -> Logger -> debug ( 'Using cached redir... | Checks the redirects against the current URI and redirects the user s browser if they ve hit a redirect URL |
55,067 | protected function handleOptions ( array & $ options = [ ] ) { parent :: handleOptions ( $ options ) ; if ( isset ( $ options [ 'reason_phrase' ] ) ) { $ this -> reasonPhrase = $ options [ 'reason_phrase' ] ; } } | Accepts and modifies the options provided to the response in the constructor . |
55,068 | protected function runEventQueue ( EventInterface $ event , EventQueueInterface $ queue , callable $ callback = null ) { try { foreach ( $ queue as $ data ) { $ res = call_user_func ( $ data [ 'data' ] , $ event ) ; $ event -> setResult ( $ res ) ; if ( $ res === false ) { $ event -> stopPropagation ( ) ; } if ( $ even... | Run an event with the provided queue |
55,069 | protected function isListener ( $ listener ) { if ( is_object ( $ listener ) && $ listener instanceof EventListenerInterface ) { return true ; } if ( is_string ( $ listener ) && is_a ( $ listener , '\\Phossa\\Event\\Interfaces\\EventListenerStaticInterface' , true ) ) { return true ; } return false ; } | Test if it is a valid listener |
55,070 | protected function getListenerEvents ( $ listener , $ eventName = '' ) { if ( ! $ this -> isListener ( $ listener ) ) { throw new Exception \ InvalidArgumentException ( Message :: get ( Message :: INVALID_EVENT_LISTENER , is_object ( $ listener ) ? get_class ( $ listener ) : $ listener ) , Message :: INVALID_EVENT_LIST... | Get listener events array |
55,071 | protected function makeCallables ( $ listener , $ callable , $ priority ) { $ result = [ ] ; if ( is_array ( $ callable ) ) { if ( isset ( $ callable [ 1 ] ) && is_int ( $ callable [ 1 ] ) ) { $ priority = $ callable [ 1 ] ; $ xc = $ callable [ 0 ] ; } else { foreach ( $ callable as $ cc ) { $ result = array_merge ( $ ... | Returns an array of callables |
55,072 | protected function attachIt ( $ eventName , $ listener , $ callable , $ priority ) { if ( $ this -> hasEventQueue ( $ eventName ) ) { $ q = $ this -> getEventQueue ( $ eventName ) ; } else { $ q = new EventQueue ( ) ; $ this -> events [ $ eventName ] = $ q ; } if ( is_null ( $ listener ) ) { if ( empty ( $ eventName ) ... | Attach callable to event queque |
55,073 | protected function detachIt ( $ eventName , $ listener , $ callable ) { if ( $ eventName != '' && ! $ this -> hasEventQueue ( $ eventName ) ) { return ; } if ( is_null ( $ listener ) ) { $ xc = [ [ $ callable , 50 ] ] ; } else { $ xc = $ this -> makeCallables ( $ listener , $ callable , 50 ) ; } if ( empty ( $ xc ) ) {... | Detach callable to event queque |
55,074 | protected function matchEventQueue ( $ eventName , EventManagerInterface $ manager ) { $ names = $ this -> globNames ( $ eventName , $ manager -> getEventNames ( ) ) ; $ queue = new EventQueue ( ) ; foreach ( $ names as $ n ) { if ( $ manager -> hasEventQueue ( $ n ) ) { $ queue = $ queue -> combine ( $ manager -> getE... | Match proper event queue with globbing support |
55,075 | protected function globNames ( $ eventName , array $ names ) { $ result = [ ] ; foreach ( $ names as $ n ) { if ( $ n === '*' || $ n === $ eventName || $ eventName === '' ) { $ result [ ] = $ n ; } elseif ( strpos ( $ n , '*' ) !== false ) { $ regex = str_replace ( array ( '.' , '*' ) , array ( '[.]' , '.*?' ) , $ n ) ... | Return those globbing event names based on the given one |
55,076 | public function from ( $ table , string $ alias = null ) : self { return $ this -> table ( $ table , $ alias ) ; } | Table method alias |
55,077 | public function addSelect ( $ columns , string $ alias = null ) : self { if ( ! is_array ( $ columns ) ) { if ( $ alias === null ) { $ columns = [ $ columns ] ; } else { $ columns = [ $ alias => $ columns ] ; } } foreach ( $ columns as $ alias => $ column ) { $ column = $ this -> checkStringValue ( 'Argument $columns['... | Adds column or columns to the SELECT section . |
55,078 | public function addCount ( $ column = '*' , string $ alias = null ) : self { return $ this -> addAggregate ( 'COUNT' , $ column , $ alias ) ; } | Adds a COUNT aggregate to the SELECT section . |
55,079 | public function addAvg ( $ column , string $ alias = null ) : self { return $ this -> addAggregate ( 'AVG' , $ column , $ alias ) ; } | Adds a AVG aggregate to the SELECT section . |
55,080 | public function addSum ( $ column , string $ alias = null ) : self { return $ this -> addAggregate ( 'SUM' , $ column , $ alias ) ; } | Adds a SUM aggregate to the SELECT section . |
55,081 | public function addMin ( $ column , string $ alias = null ) : self { return $ this -> addAggregate ( 'MIN' , $ column , $ alias ) ; } | Adds a MIN aggregate to the SELECT section . |
55,082 | public function addMax ( $ column , string $ alias = null ) : self { return $ this -> addAggregate ( 'MAX' , $ column , $ alias ) ; } | Adds a MAX aggregate to the SELECT section . |
55,083 | protected function addAggregate ( string $ function , $ column , string $ alias = null ) : self { $ column = $ this -> checkStringValue ( 'Argument $column' , $ column ) ; $ aggregate = new Aggregate ( $ function , $ column ) ; if ( $ alias === null ) { $ this -> select [ ] = $ aggregate ; } else { $ this -> select [ $... | Adds an arbitrary aggregate to the SELECT section . |
55,084 | public function run ( Migration $ migration , $ executeQueries = false , $ forcedRollback = false ) { $ this -> migration = $ migration ; try { $ this -> playQueries ( $ executeQueries ) ; if ( $ forcedRollback ) { $ this -> playRollbackQueries ( $ executeQueries ) ; } } catch ( Exception $ e ) { $ this -> playRollback... | Run a migration |
55,085 | private function playQueries ( $ executeQueries = false ) { foreach ( $ this -> migration -> getQueries ( ) as $ idx => $ query ) { try { $ this -> runQuery ( $ query , $ executeQueries ) ; } catch ( \ Exception $ e ) { if ( $ idx >= 1 ) { throw new Exception ( $ e -> getMessage ( ) ) ; } throw $ e ; } } } | Play Script queries |
55,086 | private function playRollbackQueries ( $ executeQueries = false ) { foreach ( $ this -> migration -> getRollbackQueries ( ) as $ query ) { $ this -> runQuery ( $ query , $ executeQueries ) ; } } | Play rollback queries |
55,087 | private function runQuery ( Query $ query , $ executeQueries = false ) { $ this -> playedQueries [ ] = $ query ; if ( $ executeQueries ) { $ this -> connection -> executeQuery ( ( string ) $ query ) ; } } | Run a query if execute query is true else simply add query to played queries stack |
55,088 | public function rewind ( ) { $ this -> dir -> rewind ( ) ; $ this -> iter = 0 ; $ this -> hasNext ( ) ; $ this -> cur_entry = $ this -> next_entry ; $ this -> next_entry = null ; } | Rewind the directory reader to the start |
55,089 | public function setPlatform ( $ platform ) { if ( ! in_array ( $ platform , array ( Software :: PLATFORM_MAC , Software :: PLATFORM_IOS ) , true ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Undefined software platform "%s".' , $ platform ) ) ; } $ this -> platform = $ platform ; return $ this ; } | Set software platform |
55,090 | public function setUserRatingCount ( $ userRatingCount ) { $ userRatingCount = ( int ) $ userRatingCount ; if ( $ userRatingCount < 0 ) { throw new \ InvalidArgumentException ( sprintf ( 'User rating can\'t be less than "0", "%s" given.' , $ userRatingCount ) ) ; } $ this -> userRatingCount = ( int ) $ userRatingCount ... | Set user rating count |
55,091 | public function setAverageUserRating ( $ averageUserRating ) { $ averageUserRating = ( float ) $ averageUserRating ; if ( $ averageUserRating < 0 || $ averageUserRating > 5 ) { throw new \ InvalidArgumentException ( sprintf ( 'Average user rating must be between 0 and 5, "%s" given.' , $ averageUserRating ) ) ; } if ( ... | Set user average rating |
55,092 | public function setUserRatingCountCurrent ( $ userRatingCountCurrent ) { $ userRatingCountCurrent = ( int ) $ userRatingCountCurrent ; if ( $ userRatingCountCurrent < 0 ) { throw new \ InvalidArgumentException ( sprintf ( 'User rating can\'t be less than "0", "%s" given.' , $ userRatingCountCurrent ) ) ; } $ this -> us... | Set user rating count for current version |
55,093 | public function setAverageUserRatingCurrent ( $ averageUserRatingCurrent ) { $ averageUserRatingCurrent = ( float ) $ averageUserRatingCurrent ; if ( $ averageUserRatingCurrent < 0 || $ averageUserRatingCurrent > 5 ) { throw new \ InvalidArgumentException ( sprintf ( 'Average user rating must be between 0 and 5, "%s" g... | Set average user rating for current version |
55,094 | public function actionIndex ( ) { $ model = new Events ( 'search' ) ; $ model -> unsetAttributes ( ) ; if ( isset ( $ _GET [ 'Event' ] ) ) $ model -> attributes = $ _GET [ 'Event' ] ; $ dataProvider = $ model -> search ( ) ; $ dataProvider -> pagination = array ( 'pageVar' => 'page' ) ; if ( $ dataProvider -> totalItem... | Provides functionality to search through events |
55,095 | public function actionPageviews ( ) { $ models = Events :: model ( ) -> groupByUrl ( ) -> findAll ( ) ; $ response = array ( ) ; foreach ( $ models as $ model ) $ response [ ] = array ( 'uri' => $ model -> uri , 'count' => $ model -> id ) ; return $ response ; } | Shows pageview results |
55,096 | public function setColumnNames ( array $ columnNames ) { $ this -> columnNames = array ( ) ; foreach ( $ columnNames as $ columnName ) { $ this -> addColumnName ( $ columnName ) ; } } | Sets the column names . |
55,097 | public function actionShowOrderList ( ) { if ( ! \ Yii :: $ app -> user -> isGuest ) { $ userOrders = \ Yii :: $ app -> cart -> getAllUserOrders ( ) ; $ filterModel = new OrderSearch ( ) ; $ dataProvider = $ filterModel -> search ( Yii :: $ app -> request -> get ( ) ) ; return $ this -> render ( 'order-list' , [ 'userO... | Return list of user orders . |
55,098 | public function switchOrganization ( User $ user , OrganizationInterface $ organization ) { $ role = $ this -> getOrganizationRole ( $ user , $ organization ) ; if ( $ role == false && ! $ this -> authorizationChecker -> isGranted ( 'ROLE_SUPER_ADMIN' ) ) { throw new NotFoundHttpException ( 'Roles in organization not f... | Switch the working organization of logged user |
55,099 | public function getOrganizationRole ( $ user , $ organization ) { return $ this -> dm -> getRepository ( 'WobbleCodeUserBundle:Role' ) -> findOneBy ( [ 'organization.$id' => new \ MongoId ( $ organization -> getId ( ) ) , 'user.$id' => new \ MongoId ( $ user -> getId ( ) ) ] ) ; } | Get user role definition within an organization |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.