idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
16,100
public function getErrorElement ( ) { if ( empty ( self :: $ session_vars [ "error_element" ] ) ) { return "" ; } $ felm = self :: $ session_vars [ "error_element" ] ; unset ( self :: $ session_vars [ "error_element" ] ) ; return $ felm ; }
Returns the field to be highlighted .
16,101
public function setError ( $ message , $ details = "" , $ code = "" ) { if ( empty ( $ message ) ) { return ; } self :: $ session_vars [ "errors" ] [ $ message ] = [ "message" => $ message , "details" => $ details , "code" => $ code ] ; }
Stores the error to be reported .
16,102
public function setWarning ( $ message , $ details = "" ) { if ( empty ( $ message ) ) { return ; } self :: $ session_vars [ "warnings" ] [ $ message ] = [ "message" => $ message , "details" => $ details ] ; }
Stores the warning to be reported .
16,103
public function setProgWarning ( $ message , $ details = "" ) { if ( empty ( $ message ) || ! $ this -> progWarningsActive ( ) ) { return ; } self :: $ session_vars [ "prog_warnings" ] [ $ message ] = [ "message" => $ message , "details" => $ details ] ; }
Stores the programming warning to be reported .
16,104
public function setDebugMessage ( $ message , $ details = "" ) { if ( empty ( $ message ) ) { return ; } self :: $ session_vars [ "debug" ] [ $ message ] = [ "message" => $ message , "details" => $ details ] ; }
Stores the debugging message to be reported .
16,105
public function setInfo ( $ message , $ details = "" , $ auto_hide = false ) { if ( empty ( $ message ) ) { return ; } self :: $ session_vars [ "infos" ] [ $ message ] = [ "message" => $ message , "details" => $ details , "auto_hide" => $ auto_hide ] ; }
Stores the information message to be reported .
16,106
public function clearAll ( ) { $ this -> clearErrors ( ) ; $ this -> clearWarnings ( ) ; $ this -> clearProgWarnings ( ) ; $ this -> clearDebugMessages ( ) ; $ this -> clearInfos ( ) ; unset ( self :: $ session_vars [ "focus_element" ] ) ; unset ( self :: $ session_vars [ "error_element" ] ) ; unset ( self :: $ session...
Clears all stored messages and active elements .
16,107
public function addMessagesToResponse ( & $ response ) { if ( $ this -> infosExist ( ) ) { $ response [ "INFO_MESSAGES" ] = $ this -> getInfos ( ) ; } if ( $ this -> warningsExist ( ) ) { $ response [ "WARNING_MESSAGES" ] = $ this -> getWarnings ( ) ; } if ( $ this -> errorsExist ( ) ) { $ response [ "ERROR_MESSAGES" ]...
Add all stored existing messages to the response .
16,108
public function addNode ( \ DOMNode $ node ) { if ( $ node instanceof \ DOMDocument ) { $ node = $ node -> documentElement ; } if ( null !== $ this -> document && $ this -> document !== $ node -> ownerDocument ) { throw new \ InvalidArgumentException ( 'Attaching DOM nodes from multiple documents in the same crawler is...
Adds a \ DOMNode instance to the list of nodes .
16,109
public function parents ( ) { if ( ! $ this -> nodes ) { throw new \ InvalidArgumentException ( 'The current node list is empty.' ) ; } $ node = $ this -> getNode ( 0 ) ; $ nodes = array ( ) ; while ( $ node = $ node -> parentNode ) { if ( XML_ELEMENT_NODE === $ node -> nodeType ) { $ nodes [ ] = $ node ; } } return $ ...
Returns the parents nodes of the current selection .
16,110
public function evaluate ( $ xpath ) { if ( null === $ this -> document ) { throw new \ LogicException ( 'Cannot evaluate the expression on an uninitialized crawler.' ) ; } $ data = array ( ) ; $ domxpath = $ this -> createDOMXPath ( $ this -> document , $ this -> findNamespacePrefixes ( $ xpath ) ) ; foreach ( $ this ...
Evaluates an XPath expression .
16,111
public function selectLink ( $ value ) { $ xpath = sprintf ( 'descendant-or-self::a[contains(concat(\' \', normalize-space(string(.)), \' \'), %s) ' , static :: xpathLiteral ( ' ' . $ value . ' ' ) ) . sprintf ( 'or ./img[contains(concat(\' \', normalize-space(string(@alt)), \' \'), %s)]]' , static :: xpathLiteral ( ' ...
Selects links by name or alt value for clickable images .
16,112
public function selectButton ( $ value ) { $ translate = 'translate(@type, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")' ; $ xpath = sprintf ( 'descendant-or-self::input[((contains(%s, "submit") or contains(%1$s, "button")) and contains(concat(\' \', normalize-space(string(@value)), \' \'), %s)) ' , $ tr...
Selects a button by name or alt value for images .
16,113
public function link ( $ method = 'get' ) { if ( ! $ this -> nodes ) { throw new \ InvalidArgumentException ( 'The current node list is empty.' ) ; } $ node = $ this -> getNode ( 0 ) ; if ( ! $ node instanceof \ DOMElement ) { throw new \ InvalidArgumentException ( sprintf ( 'The selected node should be instance of DOM...
Returns a Link object for the first node in the list .
16,114
public function links ( ) { $ links = array ( ) ; foreach ( $ this -> nodes as $ node ) { if ( ! $ node instanceof \ DOMElement ) { throw new \ InvalidArgumentException ( sprintf ( 'The current node list should contain only DOMElement instances, "%s" found.' , get_class ( $ node ) ) ) ; } $ links [ ] = new Link ( $ nod...
Returns an array of Link objects for the nodes in the list .
16,115
public function setVisit ( \ BlackForest \ PiwikBundle \ Entity \ PiwikVisit $ visit = null ) { $ this -> visit = $ visit ; return $ this ; }
Set visit .
16,116
public function setAction ( \ BlackForest \ PiwikBundle \ Entity \ PiwikAction $ action = null ) { $ this -> action = $ action ; return $ this ; }
Set action .
16,117
public function migrate ( ) { $ fs = new Filesystem ; $ finder = new ClassFinder ; $ path = env ( 'MIGRATIONS_PATH' , 'database/migrations' ) ; if ( $ fs -> exists ( $ path ) ) { foreach ( $ fs -> files ( $ path ) as $ file ) { $ fs -> requireOnce ( $ file ) ; $ class = $ finder -> findClass ( $ file ) ; ( new $ class ...
Run package database migrations .
16,118
public function isAvailable ( \ Magento \ Quote \ Api \ Data \ CartInterface $ quote = null ) { $ this -> _logger -> debug ( "isAvaliable Payapi" ) ; if ( ! $ this -> getConfigData ( 'payapi_api_key' ) || ! $ this -> getConfigData ( 'payapi_public_id' ) ) { return false ; } return parent :: isAvailable ( $ quote ) ; }
Determine method availability based on quote amount and config data
16,119
public static function rmVar ( $ name ) { self :: init ( ) ; if ( isset ( self :: $ variables [ $ name ] ) ) { unset ( self :: $ variables [ $ name ] ) ; } return true ; }
Remove variable ;
16,120
public static function getStrings ( $ names = array ( ) , $ vartype = '' ) { $ result = array ( ) ; if ( ! is_array ( $ names ) ) { return $ result ; } foreach ( $ names as $ name ) { $ result [ $ name ] = self :: getVar ( $ name , '' , $ vartype ) ; } return $ result ; }
Get strings array by keys ...
16,121
public function has ( $ permissions , $ all = true ) { if ( ! is_array ( $ permissions ) ) { $ permissions = ( array ) $ permissions ; } $ permissions = array_unique ( $ permissions ) ; $ filtered = array_where ( $ permissions , [ $ this , 'hasFilter' ] ) ; if ( true === $ all ) { return count ( $ permissions ) === cou...
Does this role have supplied permission
16,122
public static function setConfig ( array $ config ) { if ( ! isset ( $ config [ 'adapters' ] ) || ! is_array ( $ config [ 'adapters' ] ) ) { throw new DomainException ( 'Missing adapters configuration.' ) ; } $ defaultAdapter = static :: DEFAULT_ADAPTER ; if ( isset ( $ config [ 'defaults' ] [ 'adapter' ] ) ) { $ defau...
Sets the configuration .
16,123
public static function make ( $ namespace = null , $ adapter = null ) { $ defaults = isset ( static :: $ config [ 'defaults' ] ) ? static :: $ config [ 'defaults' ] : [ ] ; if ( ! $ adapter ) { $ adapter = isset ( $ defaults [ 'adapter' ] ) ? $ defaults [ 'adapter' ] : static :: DEFAULT_ADAPTER ; } if ( ! isset ( stati...
Make the cache adapter .
16,124
public function init ( $ config ) { $ this -> config [ 'per_page' ] = 10 ; $ this -> config [ 'item_to_show' ] = 2 ; $ this -> config [ 'skip_item' ] = true ; $ this -> config [ 'first_tag_open' ] = "<li>" ; $ this -> config [ 'first_tag_close' ] = "</li>" ; $ this -> config [ 'last_tag_open' ] = "<li>" ; $ this -> con...
Initialize pagination config
16,125
public function alias ( string $ from , string $ to , array $ params = null ) : void { if ( ! empty ( $ params ) ) { $ this -> config -> registerClassParameters ( $ to , $ params ) ; } $ this -> config -> registerClassAlias ( $ from , $ to ) ; }
Create a global alias for an interface .
16,126
public function singleton ( string $ className , array $ params = null ) : void { if ( ! is_null ( $ params ) ) { $ this -> config -> registerClassParameters ( $ className , $ params ) ; } $ this -> config -> registerSingleton ( $ className ) ; }
Treat the class as a singleton .
16,127
public function decorate ( string $ className , callable $ decorate ) : void { $ this -> config -> registerClassDecorator ( $ className , $ decorate ) ; }
Decorate a class .
16,128
public function factory ( string $ className , callable $ factory ) : void { $ this -> config -> registerClassFactory ( $ className , $ factory ) ; }
Intercept a class instantiation .
16,129
public function clear ( ) { $ key = $ this -> key ( ) ; $ files = glob ( $ this -> path . "/_cache-" . $ key . "*.cache" ) ; $ this -> setKey ( ) ; $ this -> key ( true ) ; foreach ( $ files as $ file ) { unlink ( $ file ) ; } return $ this ; }
Clear all of the values set by this cache instance .
16,130
public function createValue ( $ value , $ expiration ) { $ expiration = $ expiration ? str_pad ( $ expiration , 11 , "0" . STR_PAD_LEFT ) : "00000000000" ; return $ expiration . $ value ; }
Create a parsable value from the data and expiration date .
16,131
public function key ( $ reset = false ) { static $ key ; $ key = $ reset ? false : $ key ; if ( ! $ key ) { $ path = $ this -> path . "/.cache_key" ; if ( file_exists ( $ path ) ) { $ key = file_get_contents ( $ path ) ; } else { $ key = $ this -> setKey ( ) ; } } return $ key ; }
Gets the current cache namespace key .
16,132
public function setKey ( ) { $ path = $ this -> path . "/.cache_key" ; $ key = bin2hex ( openssl_random_pseudo_bytes ( 6 ) ) ; $ umask = umask ( $ this -> umask ) ; file_put_contents ( $ path , $ key ) ; umask ( $ umask ) ; return $ key ; }
Set the current cache key .
16,133
public function load ( CachedCollectionInterface $ routes ) { if ( ! is_file ( $ file = $ this -> getFilePath ( $ routes ) ) || filemtime ( $ file ) < $ routes -> getTimestamp ( ) ) { $ this -> dumpMap ( $ routes , $ file ) ; } return $ this -> loadMap ( $ file ) ; }
Get the statuc route map .
16,134
public function setTemplate ( $ template ) { $ layout = $ this -> getViewModel ( ) ; $ layout -> setTemplate ( ( string ) $ template ) ; return $ this ; }
Sets the layout template .
16,135
public function setModule ( $ module ) { $ layout = $ this -> getViewModel ( ) ; $ layout -> setModule ( ( string ) $ module ) ; return $ this ; }
Sets the layout module name .
16,136
public function getView ( $ view ) { $ path = explode ( "/" , $ view ) ; include ( count ( $ path ) > 1 ) ? "src/views/" . $ path [ 0 ] . "/" . $ path [ 1 ] . ".php" : "src/views/" . $ path [ 0 ] . "/index.php" ; }
view being called is in the views directory additional directories are taken into account .
16,137
public function get ( ) { if ( ! $ this -> isTracking ( ) ) { return false ; } $ statusPacket = json_decode ( $ this -> resqueInstance -> redis -> get ( ( string ) $ this ) , true ) ; if ( ! $ statusPacket ) { return false ; } return $ statusPacket [ 'status' ] ; }
Fetch the status for the job being monitored .
16,138
public function setCredentials ( ? string $ gApiServiceAccountCredentialsFilePath = null ) : string { $ this -> client = null ; $ this -> getClient ( $ gApiServiceAccountCredentialsFilePath ) ; return $ this -> getCredentialsFilePath ( ) ; }
A helper method allowing to use different credentials during the lifecycle of the application .
16,139
public function getMapping ( ) { if ( null === $ this -> mapping ) { $ mappingFilePath = $ this -> locateFile ( $ this -> mappingFileName ) ; if ( is_array ( $ mappingFilePath ) ) { throw new \ Exception ( "The mapping file wasn't found. Locations we tried: " . join ( ', ' , $ mappingFilePath ) ) ; } elseif ( ! is_read...
Returns the array resulting from mapping . yaml .
16,140
private function locateFile ( $ fileName , ? string $ userSuppliedPath = null ) { $ locations = [ $ this -> projectDir . DIRECTORY_SEPARATOR . $ fileName , ] ; if ( getcwd ( ) !== $ this -> projectDir ) { $ locations [ ] = getcwd ( ) . DIRECTORY_SEPARATOR . $ fileName ; } $ locationsFailed = [ ] ; if ( null !== $ userS...
Looks for a specified file name in various locations .
16,141
public function error ( Base $ app , array $ params ) { $ eol = PHP_EOL ; $ req = $ app [ 'VERB' ] . ' ' . $ app [ 'PATH' ] ; $ error = ( $ app [ 'ERROR' ] ? : [ ] ) + [ 'text' => 'No-Message' , 'trace' => 'No-Trace' , 'status' => 'No-Status' , 'code' => '000' , ] ; $ this -> log ( sprintf ( "[%s] %s %s" , $ req , $ er...
Custom error handler with ability to log error and its trace
16,142
private function _loadRoles ( array $ aclConfig ) { foreach ( $ aclConfig as $ role => $ acl ) { if ( isset ( $ acl [ self :: CONFIG_FIELD_RESOURCE ] ) and is_array ( $ acl [ self :: CONFIG_FIELD_RESOURCE ] ) ) { $ this -> _roles [ $ role ] = $ acl [ self :: CONFIG_FIELD_RESOURCE ] ; } else { $ this -> _roles [ $ role ...
Load the roles from the ACL configuration file .
16,143
public function isAllowed ( $ pRole , array $ pResources ) { foreach ( $ pResources as $ resource ) { if ( ! isset ( $ this -> _roles [ $ pRole ] ) or ! in_array ( $ resource , $ this -> _roles [ $ pRole ] ) ) { return false ; } } return true ; }
Check if the role exists and if the resource is available with this role .
16,144
public function decode ( array $ options = [ ] ) { $ json = json_decode ( $ this -> getContents ( ) , true ) ; if ( $ json === null && json_last_error ( ) === JSON_ERROR_NONE ) { $ this -> validateSyntax ( ) ; return $ this ; } $ this -> validateSchema ( ) ; return $ json ; }
Decodes JSON data .
16,145
protected function validateSchema ( ) { $ schemaPath = $ this -> getOption ( 'schemaPath' ) ; if ( $ schemaPath === null ) { return ; } $ schemaData = json_decode ( file_get_contents ( $ schemaPath ) ) ; if ( ! class_exists ( '\\JsonSchema\\Validator' ) ) { throw new \ RuntimeException ( 'If you want to validate a JSON...
Validates JSON schema .
16,146
protected function validateSyntax ( ) { if ( ! class_exists ( '\\Seld\\JsonLint\\JsonParser' ) ) { throw new \ RuntimeException ( 'If you want to validate JSON syntax using lint, you must require package "seld/jsonlint".' ) ; } $ parser = new \ Seld \ JsonLint \ JsonParser ( ) ; $ result = $ parser -> lint ( $ this -> ...
Validates JSON syntax using lint .
16,147
public function addSimpleCondition ( string $ p_operator , string $ p_left , $ p_right = null ) { $ condition = \ FreeFW \ DI \ DI :: get ( 'FreeFW::Model::Condition' ) ; $ left = null ; if ( strpos ( $ p_left , '::Model::' ) !== false ) { $ left = new \ FreeFW \ Model \ ConditionMember ( ) ; $ left -> setField ( $ p_l...
Add simple condition
16,148
public function conditionLower ( string $ p_member , $ p_value ) { return $ this -> addSimpleCondition ( \ FreeFW \ Storage \ Storage :: COND_LOWER , $ p_member , $ p_value ) ; }
Simple lower condition
16,149
public function search ( $ key ) { $ splitOffset = $ this -> getSplitOffset ( ) ; $ keys = $ this -> index -> getKeyReader ( ) -> readKeys ( $ splitOffset , self :: DIRECTION_FORWARD ) ; $ foundKey = $ this -> findKey ( $ key , $ keys ) ; if ( ! is_null ( $ foundKey ) ) { return $ foundKey ; } if ( $ this -> isKeyRange...
Searches for a key or some neighbour
16,150
private function isKeyRange ( $ key , Array $ keys ) { if ( empty ( $ keys ) ) { return false ; } return \ reset ( $ keys ) -> getKey ( ) <= $ key && \ end ( $ keys ) -> getKey ( ) >= $ key ; }
Returns true if the key is expected to be in the key list
16,151
private function getSplitOffset ( ) { $ blocks = ( int ) $ this -> range -> getLength ( ) / $ this -> index -> getKeyReader ( ) -> getReadLength ( ) ; $ centerBlock = ( int ) $ blocks / 2 ; return $ this -> range -> getOffset ( ) + $ centerBlock * $ this -> index -> getKeyReader ( ) -> getReadLength ( ) ; }
Returns the offset for the split
16,152
public static function execute ( $ q ) { if ( ! isset ( self :: $ pest ) ) $ p = new \ Pest ( self :: API ) ; $ json = $ p -> get ( '' , [ 'q' => $ q , 'format' => 'json' , 'diagnostics' => false , 'env' => 'http://datatables.org/alltables.env' , ] ) ; return new Result ( $ json ) ; }
Runs the Query against Yahoo s Database
16,153
private function writeLine ( $ text , $ indent = 0 ) { $ indent = strlen ( $ text ) + $ indent ; $ format = '%' . $ indent . 's' ; $ this -> reference .= sprintf ( $ format , $ text ) . PHP_EOL ; }
Outputs a single config reference line .
16,154
public function parse ( array $ criteria , array $ orderBy = array ( ) , $ limit = null , $ offset = null ) { $ statement = new Expr \ Statement ( ) ; if ( ! empty ( $ criteria ) ) { $ statement -> setClause ( 'condition' , $ this -> parseCriteria ( $ criteria ) ) ; } if ( ! empty ( $ orderBy ) ) $ statement -> setClau...
parse Parse fields criteria and order
16,155
protected function parseOrXValues ( $ field , $ values ) { $ exprs = array ( ) ; foreach ( $ values as $ value ) { $ exprs [ ] = $ this -> parseFieldValue ( $ field , $ value ) ; } return $ this -> expr ( ) -> orX ( $ exprs ) ; }
parseOrXValues parse deep array as a orx
16,156
public function set ( array $ pairs ) { foreach ( $ pairs as $ column => $ value ) { $ this -> _set [ ] = array ( $ column , $ value ) ; } return $ this ; }
Set the values to update with an associative array .
16,157
public function on ( $ c1 , $ op , $ c2 ) { $ this -> _last_join -> on ( $ c1 , $ op , $ c2 ) ; return $ this ; }
Adds ON ... conditions for the last created JOIN statement .
16,158
public function callProtectedMethod ( $ object , string $ method , array $ arguments = [ ] ) { if ( ! is_object ( $ object ) ) { $ msg = $ this -> getErrorMessage ( 1 , __METHOD__ , $ object ) ; throw new InvalidArgumentException ( $ msg ) ; } $ class = new ReflectionClass ( $ object ) ; $ method = $ class -> getMethod...
Calls a protected or private method and returns its result .
16,159
public function onCssLastModified ( ContentEvent $ event ) { $ reflection = new \ ReflectionClass ( get_class ( $ this ) ) ; if ( strpos ( $ reflection -> getFileName ( ) , '/cache/' ) ) { $ dir = dirname ( $ reflection -> getFileName ( ) ) . '/../../..' ; } else { $ dir = dirname ( $ reflection -> getFileName ( ) ) . ...
Este listener calcula lastmodified de la ruta
16,160
public function hasPermission ( $ permission ) { if ( ! is_array ( $ this -> permissionsMap ) ) { $ permissionsMap = cache ( ) -> get ( 'permissions:' . $ this -> id , null ) ; if ( $ permissionsMap === null ) { $ this -> permissionsMap = $ this -> buildPermissionsMap ( ) ; cache ( ) -> forever ( 'permissions:' . $ thi...
It checks if given user have specified permission
16,161
private function buildPermissionsMap ( ) { $ permissionsMap = [ ] ; $ roles = $ this -> roles ( ) -> with ( 'permissions' ) -> get ( ) -> toArray ( ) ; foreach ( $ roles as $ role ) { if ( ! empty ( $ role [ 'permissions' ] ) ) { foreach ( $ role [ 'permissions' ] as $ permission ) { $ permissionsMap [ ] = $ permission...
It build permission map . Later we store this map cache .
16,162
public function singleton ( $ className ) { $ closure = function ( ContainerInterface $ container ) use ( $ className ) { static $ instance ; if ( is_null ( $ instance ) ) { $ instance = $ container -> make ( $ className ) ; } return $ instance ; } ; $ this -> bind ( $ className , $ closure ) ; }
Register a shared binding
16,163
public function resolve ( $ key ) { if ( ! array_key_exists ( $ key , $ this -> bindings ) ) { throw new InvalidArgumentException ( "{$key} is not bound." ) ; } $ binding = $ this -> bindings [ $ key ] ; $ value = $ binding [ 'value' ] ; if ( $ value instanceof Closure ) { return $ value ( $ this ) ; } if ( is_null ( $...
Resolve the value from the given offset
16,164
protected function getDependencies ( ReflectionClass $ refl ) { if ( ! $ refl -> isInstantiable ( ) ) { return [ ] ; } $ constr = $ refl -> getConstructor ( ) ; if ( ! $ constr ) { return [ ] ; } return $ constr -> getParameters ( ) ; }
Get an array of object dependencies
16,165
protected function resolveDependency ( ReflectionParameter $ dep ) { $ depName = $ dep -> getName ( ) ; if ( $ dep -> getClass ( ) ) { $ depName = $ dep -> getClass ( ) -> name ; } if ( array_key_exists ( $ depName , $ this -> bindings ) ) { return $ this -> resolve ( $ depName ) ; } if ( class_exists ( '\\' . $ depNam...
Resolve object dependency
16,166
public function getVersionString ( $ bits = null ) { if ( is_null ( $ bits ) ) { return $ this -> version ; } return implode ( '.' , $ this -> versionFromBits ( $ bits ) ) ; }
Get the version number as a dot seperated string .
16,167
private function extractVersion ( ) { $ git = Executable :: make ( $ this -> gitBin ) -> addArgument ( sprintf ( '--git-dir=%s' , $ this -> gitPath ) ) -> addArgument ( 'describe' ) -> addArgument ( '--tags' ) -> addArgument ( '--always' ) ; try { $ git -> execute ( ) ; } catch ( \ Ballen \ Executioner \ Exceptions \ E...
Extracts the version from the Git repository .
16,168
private function versionBits ( ) { $ versionBits = explode ( '-' , $ this -> version ) ; if ( strlen ( $ versionBits [ 0 ] ) ) { $ this -> version = $ versionBits [ 0 ] ; if ( isset ( $ versionBits [ 1 ] ) ) { $ this -> version = $ versionBits [ 0 ] . '.' . $ versionBits [ 1 ] ; } if ( isset ( $ versionBits [ 2 ] ) ) {...
Computes and sets the version number and object hash properties .
16,169
private function versionFromBits ( $ bits ) { $ version = [ ] ; foreach ( range ( 0 , ( $ bits - 1 ) ) as $ bit ) { $ version [ $ bit ] = $ this -> getVersionBits ( ) [ $ bit ] ; } return $ version ; }
Returns an customised array of the total number of version bits .
16,170
public function load ( array $ configs , ContainerBuilder $ container ) { $ loader = new XmlFileLoader ( $ container , new FileLocator ( __DIR__ . '/../Resources/config' ) ) ; $ loader -> load ( 'converter.xml' ) ; $ loader -> load ( 'event.xml' ) ; $ loader -> load ( 'event_listeners.xml' ) ; $ loader -> load ( 'comma...
Load the configuration
16,171
public function setEmail ( $ email ) { $ email = is_null ( $ email ) ? '' : $ email ; parent :: setEmail ( $ email ) ; $ this -> setUsername ( $ email ) ; return $ this ; }
Set email Also sets the username to the email
16,172
public function login ( $ force = false ) { if ( ! $ force && static :: isLogged ( ) ) { static :: throwException ( 'alreadyLoggedin' ) ; } global $ USER ; $ _SESSION [ 'USER' ] = $ USER = $ this ; $ this -> login = $ force ? self :: LOGGED_FORCED : self :: IS_LOGGED ; if ( ! $ force ) { static :: logEvent ( 'login' ) ...
Log in this user to the current session .
16,173
public function logout ( $ reason = null ) { global $ USER ; if ( ! $ this -> login ) { return false ; } $ this -> login = self :: NOT_LOGGED ; $ _SESSION [ 'USER' ] = $ USER = null ; $ _SESSION [ 'LOGOUT_REASON' ] = $ reason ; return true ; }
Log out this user from the current session .
16,174
public function checkAccess ( $ module ) { if ( ! isset ( $ GLOBALS [ 'ACCESS' ] -> $ module ) ) { return true ; } return $ this -> checkPerm ( ( int ) $ GLOBALS [ 'ACCESS' ] -> $ module ) ; }
Check access permissions
16,175
public function canDo ( $ action , $ object = null ) { return $ this -> equals ( $ object ) || ( $ this -> checkPerm ( $ action ) && ( ! ( $ object instanceof AbstractUser ) || $ this -> canAlter ( $ object ) ) ) ; }
Check if this user can affect data on the given user
16,176
public static function userLogin ( $ data , $ loginField = 'email' ) { if ( empty ( $ data [ $ loginField ] ) ) { static :: throwException ( 'invalidLoginID' ) ; } $ name = $ data [ $ loginField ] ; if ( empty ( $ data [ 'password' ] ) ) { static :: throwException ( 'invalidPassword' ) ; } $ password = hashString ( $ d...
Logs in an user using data
16,177
public static function httpLogin ( ) { $ user = static :: get ( array ( 'where' => 'name LIKE ' . static :: formatValue ( $ _SERVER [ 'PHP_AUTH_USER' ] ) , 'output' => SQLAdapter :: OBJECT ) ) ; if ( empty ( $ user ) ) { static :: throwNotFound ( ) ; } if ( $ user -> password != static :: hashPassword ( $ _SERVER [ 'PH...
Log in an user from HTTP authentication according to server variables PHP_AUTH_USER and PHP_AUTH_PW
16,178
public static function httpAuthenticate ( ) { try { static :: httpLogin ( ) ; return true ; } catch ( NotFoundException $ e ) { if ( Config :: get ( 'httpauth_autocreate' ) ) { $ user = static :: httpCreate ( ) ; $ user -> login ( ) ; return true ; } } catch ( UserException $ e ) { } return false ; }
Login from HTTP authentication create user if not existing
16,179
public static function load ( $ id , $ nullable = true , $ usingCache = true ) { if ( static :: getLoggedUserID ( ) == $ id ) { return $ GLOBALS [ 'USER' ] ; } return parent :: load ( $ id , $ nullable , $ usingCache ) ; }
Load an user object
16,180
public static function loggedCanAccessToRoute ( $ route , $ accesslevel ) { $ user = static :: getLoggedUser ( ) ; if ( ! ctype_digit ( $ accesslevel ) ) { $ accesslevel = static :: getRoleAccesslevel ( $ accesslevel ) ; } $ accesslevel = ( int ) $ accesslevel ; return ( empty ( $ user ) && $ accesslevel < 0 ) || ( ! e...
Check if this user can access to a module
16,181
public static function loggedHasDeveloperAccess ( ) { $ user = static :: getLoggedUser ( ) ; $ requiredAccessLevel = ( int ) static :: getRoleAccesslevel ( 'developer' ) ; return $ user && $ user -> checkPerm ( $ requiredAccessLevel ) ; }
Check if this user has developer access
16,182
public static function loggedCanDo ( $ action , AbstractUser $ object = null ) { global $ USER ; return ! empty ( $ USER ) && $ USER -> canDo ( $ action , $ object ) ; }
Check if this user can do a restricted action
16,183
public static function checkForObject ( $ data , $ ref = null ) { if ( empty ( $ data [ 'email' ] ) ) { return ; } $ where = 'email LIKE ' . static :: formatValue ( $ data [ 'email' ] ) ; $ what = 'email' ; if ( ! empty ( $ data [ 'name' ] ) ) { $ what .= ', name' ; $ where .= ' OR name LIKE ' . static :: formatValue (...
Check for object
16,184
private static function localeNumber ( $ number , int $ decimal = 2 ) : string { return Number :: getNumber ( self :: prepareFloat ( $ number ) , $ decimal ) ; }
Vrati zformatovane cislo
16,185
private static function localeDateTime ( $ datetime , bool $ withSeconds = false ) : string { return Date :: getDateTime ( $ datetime , $ withSeconds ) ; }
Lokalizovane datum s casem
16,186
public function aggregate ( array $ pipeline , array $ options = array ( ) ) { if ( ! array_key_exists ( 0 , $ pipeline ) ) { $ pipeline = func_get_args ( ) ; $ options = array ( ) ; } if ( $ this -> eventManager -> hasListeners ( Events :: preAggregate ) ) { $ this -> eventManager -> dispatchEvent ( Events :: preAggre...
Invokes the aggregate command .
16,187
public function count ( array $ query = array ( ) , $ limitOrOptions = 0 , $ skip = 0 ) { $ options = is_array ( $ limitOrOptions ) ? array_merge ( array ( 'limit' => 0 , 'skip' => 0 ) , $ limitOrOptions ) : array ( 'limit' => $ limitOrOptions , 'skip' => $ skip ) ; $ options [ 'limit' ] = ( integer ) $ options [ 'limi...
Invokes the count command .
16,188
public function distinct ( $ field , array $ query = array ( ) , array $ options = array ( ) ) { if ( $ this -> eventManager -> hasListeners ( Events :: preDistinct ) ) { $ this -> eventManager -> dispatchEvent ( Events :: preDistinct , new DistinctEventArgs ( $ this , $ field , $ query ) ) ; } $ result = $ this -> doD...
Invokes the distinct command .
16,189
public function near ( $ near , array $ query = array ( ) , array $ options = array ( ) ) { if ( $ this -> eventManager -> hasListeners ( Events :: preNear ) ) { $ this -> eventManager -> dispatchEvent ( Events :: preNear , new NearEventArgs ( $ this , $ query , $ near , $ options ) ) ; } $ result = $ this -> doNear ( ...
Invokes the geoNear command .
16,190
protected function doAggregate ( array $ pipeline , array $ options = array ( ) ) { if ( isset ( $ options [ 'cursor' ] ) && ( $ options [ 'cursor' ] || is_array ( $ options [ 'cursor' ] ) ) ) { return $ this -> doAggregateCursor ( $ pipeline , $ options ) ; } unset ( $ options [ 'cursor' ] ) ; list ( $ commandOptions ...
Execute the aggregate command .
16,191
protected function doAggregateCursor ( array $ pipeline , array $ options = array ( ) ) { if ( ! method_exists ( 'RiakCollection' , 'aggregateCursor' ) ) { throw new BadMethodCallException ( 'RiakCollection::aggregateCursor() is not available' ) ; } list ( $ commandOptions , $ clientOptions ) = isset ( $ options [ 'soc...
Executes the aggregate command and returns a RiakCommandCursor .
16,192
protected function doBatchInsert ( array & $ a , array $ options = array ( ) ) { $ options = isset ( $ options [ 'safe' ] ) ? $ this -> convertWriteConcern ( $ options ) : $ options ; $ options = isset ( $ options [ 'wtimeout' ] ) ? $ this -> convertWriteTimeout ( $ options ) : $ options ; $ options = isset ( $ options...
Execute the batchInsert query .
16,193
protected function doFindAndUpdate ( array $ query , array $ newObj , array $ options ) { list ( $ commandOptions , $ clientOptions ) = isset ( $ options [ 'socketTimeoutMS' ] ) || isset ( $ options [ 'timeout' ] ) ? $ this -> splitCommandAndClientOptions ( $ options ) : array ( $ options , array ( ) ) ; $ command = ar...
Execute the findAndModify command with the update option .
16,194
protected function doSave ( array & $ a , array $ options ) { $ options = isset ( $ options [ 'safe' ] ) ? $ this -> convertWriteConcern ( $ options ) : $ options ; $ options = isset ( $ options [ 'wtimeout' ] ) ? $ this -> convertWriteTimeout ( $ options ) : $ options ; $ options = isset ( $ options [ 'timeout' ] ) ? ...
Execute the save query .
16,195
protected function doUpdate ( array $ query , array $ newObj , array $ options ) { $ options = isset ( $ options [ 'safe' ] ) ? $ this -> convertWriteConcern ( $ options ) : $ options ; $ options = isset ( $ options [ 'wtimeout' ] ) ? $ this -> convertWriteTimeout ( $ options ) : $ options ; $ options = isset ( $ optio...
Execute the update query .
16,196
protected function wrapCursor ( \ RiakCursor $ cursor , $ query , $ fields ) { return new Cursor ( $ this , $ cursor , $ query , $ fields , $ this -> numRetries ) ; }
Wraps a RiakCursor instance with a Cursor .
16,197
public function isRendered ( ) { $ hasChildren = 0 < count ( $ this -> children ) ; if ( true === $ this -> rendered || ! $ hasChildren ) { return $ this -> rendered ; } if ( $ hasChildren ) { foreach ( $ this -> children as $ child ) { if ( ! $ child -> isRendered ( ) ) { return false ; } } return $ this -> rendered =...
Returns whether the view was already rendered .
16,198
public function getParam ( $ name , $ default = null ) { switch ( $ name ) { case 'processor' : return $ this -> getProcessor ( ) ; case 'message' : return $ this -> getMessage ( ) ; case 'result' : return $ this -> getResult ( ) ; default : return parent :: getParam ( $ name , $ default ) ; } }
Get event parameter
16,199
public function getParams ( ) { $ params = parent :: getParams ( ) ; $ params [ 'processor' ] = $ this -> getProcessor ( ) ; $ params [ 'message' ] = $ this -> getMessage ( ) ; $ params [ 'result' ] = $ this -> getResult ( ) ; return $ params ; }
Get all event parameters