idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
230,600
public static function shift ( string & $ str , string $ encoding = null ) { $ encoding = $ encoding ? : mb_internal_encoding ( ) ; $ first = mb_substr ( $ str , 0 , 1 , $ encoding ) ; $ str = mb_substr ( $ str , 1 , null , $ encoding ) ; return $ first ; }
Shift a character off the beginning of string
230,601
public static function cutStart ( string $ str , string $ subString = ' ' , bool $ repeat = false , bool $ caseSensitive = true ) : string { $ prepared = RegEx :: prepare ( $ subString , '/' ) ; $ regex = sprintf ( '/^%s/%s' , ( $ subString ? ( $ repeat ? RegexHelper :: quantifyGroup ( $ prepared , 0 ) : $ prepared ) :...
Cut substring from the beginning of string
230,602
public function getAllDownloads ( ) { try { $ directoryIterator = new \ DirectoryIterator ( $ this -> downloadDir ) ; $ downloads = [ ] ; foreach ( $ directoryIterator as $ file ) { if ( ! $ file -> isFile ( ) ) { continue ; } if ( "." === $ file -> getBasename ( ) [ 0 ] ) { continue ; } $ downloads [ $ file -> getFile...
Returns a list of all downloads
230,603
static function imageAdjustOrientation ( $ path ) { $ image = new \ imagick ( ) ; if ( ! $ image -> readImage ( $ path ) ) return FALSE ; $ orientation = $ image -> getImageOrientation ( ) ; $ rotated = false ; switch ( $ orientation ) { case \ imagick :: ORIENTATION_BOTTOMRIGHT : $ image -> rotateimage ( "#000" , 180 ...
If exif data indicates a rotated image we apply the transformation to the image and set back orientation to normal
230,604
public function indexAction ( Request $ request , PaginatorInterface $ paginator , TokenStorageInterface $ token_storage ) : Response { $ repo = $ this -> em -> getRepository ( Invitation :: class ) ; $ query = $ repo -> findPendingInvitationsQuery ( $ token_storage -> getToken ( ) -> getUser ( ) ) ; $ invitations = $ ...
Show a list of pending invitations for the current user .
230,605
public function respondAction ( int $ id , string $ response , AuthorizationCheckerInterface $ auth ) : Response { $ repo = $ this -> em -> getRepository ( Invitation :: class ) ; if ( null === $ invitation = $ repo -> findOneBy ( [ 'id' => $ id ] ) ) { throw new NotFoundHttpException ( ) ; } if ( ! $ auth -> isGranted...
Respond to an individual invitation .
230,606
public static function permission ( $ request = null , $ match = null ) { if ( ! $ request -> user || $ request -> user -> isAnonymous ( ) ) { return false ; } $ per = new User_Role ( ) ; $ sql = new Pluf_SQL ( 'code_name=%s' , array ( $ match [ 'metricName' ] ) ) ; $ items = $ per -> getList ( array ( 'filter' => $ sq...
Retruns permision status
230,607
private function fileLineGenerator ( string $ fileName , callable $ formatter = null ) { $ f = fopen ( $ fileName , 'r' ) ; try { while ( $ line = fgets ( $ f ) ) { if ( ! is_null ( $ formatter ) ) { yield call_user_func ( $ formatter , $ line ) ; } else { yield $ line ; } } } finally { fclose ( $ f ) ; } }
Read from a file one line at a time .
230,608
public function toWords ( $ todo = null ) { $ this -> toWords = true ; if ( $ todo !== null ) $ this -> todo = $ todo ; if ( $ this -> todo !== null ) return $ this -> doQuadrillion ( ) ; }
Converts the figure todo value to words
230,609
public function toFigure ( $ todo = null ) { $ this -> toWords = false ; if ( $ todo !== null ) $ this -> todo = $ todo ; if ( $ this -> todo !== null ) return $ this -> doQuadrillion ( ) ; }
Converts the word todo value to figure
230,610
protected function compileNestedJoinConstraint ( array $ clause ) { $ clauses = [ ] ; foreach ( $ clause [ 'join' ] -> clauses as $ nestedClause ) { $ clauses [ ] = $ this -> compileJoinConstraint ( $ nestedClause ) ; } $ clauses [ 0 ] = $ this -> removeLeadingBoolean ( $ clauses [ 0 ] ) ; $ clauses = implode ( ' ' , $...
Create a nested join clause constraint segment .
230,611
public function toArray ( ) { $ output = iterator_to_array ( $ this ) ; foreach ( $ output as $ index => $ value ) { if ( $ value instanceof self ) $ output [ $ index ] = $ value -> toArray ( ) ; } return $ output ; }
toArray will return turn itself into arrays
230,612
public function getLifetime ( ) { if ( ! self :: $ lifetime ) { $ sessionExpirationHours = engineGet ( 'Config' , 'sessionExpirationHours' , false ) ; if ( ! $ sessionExpirationHours ) $ sessionExpirationHours = 2 ; self :: $ lifetime = 60 * 60 * $ sessionExpirationHours ; } return self :: $ lifetime ; }
Fetch the life time for the session
230,613
public static function save ( $ key , $ value , $ duration = null ) { self :: setLifetime ( $ duration ) ; static :: init ( ) ; $ _SESSION [ self :: $ prepend . $ key ] = $ value ; }
Saves to session
230,614
public static function fetch ( $ key ) { static :: init ( ) ; if ( isset ( $ _SESSION [ self :: $ prepend . $ key ] ) ) return $ _SESSION [ self :: $ prepend . $ key ] ; }
Fetches from session
230,615
public static function remove ( $ key ) { static :: init ( ) ; if ( isset ( $ _SESSION [ self :: $ prepend . $ key ] ) ) unset ( $ _SESSION [ self :: $ prepend . $ key ] ) ; }
Removes from session
230,616
public function run ( $ data ) { $ this -> task -> addValues ( $ data ) ; if ( $ this -> task -> validate ( ) === true ) { return $ this -> task -> run ( ) ; } $ errors = $ this -> task -> getErrors ( ) ; Env :: error ( $ this -> formatErrors ( $ errors ) ) ; }
Run a task
230,617
public static function makeFromObject ( $ object ) { $ refl = new \ ReflectionClass ( __CLASS__ ) ; $ obj = $ refl -> newInstanceWithoutConstructor ( ) ; $ obj -> isValid = true ; $ obj -> decoded = $ object ; return $ obj ; }
Static entry point to generate a json_object from something that can be json_serialized We don t need to validate or calc the json representation as this can be calculated lazily
230,618
public function isValid ( & $ exception = null ) { $ exception = null ; if ( $ this -> isValid === null ) { $ this -> decoded = @ json_decode ( $ this -> json , true ) ; if ( null === $ this -> decoded and JSON_ERROR_NONE !== $ lastError = json_last_error ( ) ) { $ this -> isValid = new BadJsonException ( $ this -> jso...
Does or json object contain valid json
230,619
public static function create ( LoopInterface $ loop , callable $ check , $ value = null , $ iterations = 1 ) { return ( new self ( $ loop , $ check , $ value , $ iterations ) ) -> run ( ) ; }
Factory used by tickingFuturePromise see there for more details .
230,620
protected function run ( ) { futurePromise ( $ this -> loop ) -> then ( function ( ) : void { $ this -> check ( ) ; } ) ; return $ this -> deferred -> promise ( ) ; }
Run the ticking future promise .
230,621
public function validate ( $ value ) { return is_int ( $ value ) ? Ok :: unit ( ) : Error :: unit ( [ Error :: NON_INT ] ) ; }
Tells if a given value is a valid int .
230,622
public function format ( \ Throwable $ e , $ h1 ) { return $ this -> body ( $ e , $ h1 , $ this -> _stackTraceFormatter -> format ( new StackTrace ( $ e ) ) ) ; }
Format an exception as a string with suitable format
230,623
public function execute ( $ key = null , $ default = null , $ data = null ) { if ( is_array ( $ key ) ) { foreach ( $ key as $ index ) { if ( ! isset ( $ data [ $ index ] ) ) { return $ default ; } $ data = $ data [ $ index ] ; } return $ data ; } if ( $ key && isset ( $ data [ $ key ] ) ) { return $ data [ $ key ] ; }...
Get value from array string
230,624
public static function make ( array $ data , array $ rules , $ unknown = null , $ custom = [ ] ) { $ factory = new ValidatorFactory ( ) ; if ( is_array ( $ unknown ) && count ( $ unknown ) > 0 ) { $ custom = $ unknown ; } $ response = $ factory -> make ( $ data , $ rules , $ custom ) ; if ( isset ( $ _SERVER [ 'HTTP_X_...
Make a new validator
230,625
protected function NextItem ( ) { if ( $ this -> used ) $ this -> iterator -> next ( ) ; $ this -> used = true ; return $ this -> iterator -> current ( ) ; }
NextItem This function is used if the caller uses MoveNext on the iterator
230,626
public function fetchData ( ) { if ( isset ( $ _SERVER [ $ this -> options [ "environment" ] ] ) ) { $ message = "Using token from environent" ; $ header = $ _SERVER [ $ this -> options [ "environment" ] ] ; } else { $ message = "Using token from request header" ; $ header = $ this -> app -> request -> headers ( "Autho...
Fetch the access token
230,627
protected function setArrayToStringForUrl ( $ sSeparator , $ aElements , $ aExceptedElements = [ '' ] ) { $ outArray = $ this -> normalizeArrayForUrl ( $ aElements ) ; if ( count ( $ outArray ) < 1 ) { return '' ; } $ xptArray = $ this -> normalizeArrayForUrl ( $ aExceptedElements ) ; $ finalArray = array_diff_key ( $ ...
Converts an array to string
230,628
private function setStartingPageRecord ( $ sDefaultPageNo , $ iRecordsPerPage , $ iAllRecords , $ bKeepFullPage = true ) { if ( is_null ( $ this -> tCmnSuperGlobals -> get ( 'page' ) ) ) { switch ( $ sDefaultPageNo ) { case 'last' : $ iStartingPageRecord = $ iAllRecords - $ iRecordsPerPage ; break ; case 'first' : defa...
Returns starting records for LIMIT clause on SQL interrogation
230,629
public function validateUniqueLink ( $ attribute ) { $ params = Yii :: $ app -> request -> get ( ) ; $ query = PageLang :: find ( ) -> joinWith ( 'page' ) -> andWhere ( [ PageLang :: tableName ( ) . '.language' => Yii :: $ app -> wavecms -> editedLanguage , PageLang :: tableName ( ) . '.link' => $ this -> link ] ) ; if...
Validator for unique link per language
230,630
private function getSecurityToken ( ) { if ( $ this -> container -> get ( 'security.context' ) -> getToken ( ) instanceof TokenInterface ) { return $ this -> container -> get ( 'security.context' ) -> getToken ( ) ; } return null ; }
Lazy Loading of security context . Returns TokenInterface
230,631
final protected static function occurred ( array $ payload , ? TimeProvider $ timeProvider = null ) { $ timeProvider = $ timeProvider ?? new SystemTimeProvider ( ) ; return new static ( $ payload , $ timeProvider -> getCurrentTime ( ) ) ; }
Instantiate new event .
230,632
public function init ( $ iBlogId ) { $ this -> iActiveBlogId = $ iBlogId ; $ this -> aAvailable [ $ iBlogId ] = array ( ) ; $ this -> aEnabled [ $ iBlogId ] = array ( ) ; $ this -> aAvailable [ $ iBlogId ] = Components :: skins ( 'nails/module-blog' ) ; if ( empty ( $ this -> aAvailable [ $ iBlogId ] ) ) { throw new Sk...
Setup the model for use with a particular skin
230,633
public function get ( $ sSlug ) { $ aSkins = $ this -> getAll ( ) ; foreach ( $ aSkins as $ oSkin ) { if ( $ oSkin -> slug == $ sSlug ) { return $ oSkin ; } } return false ; }
Gets a single skin
230,634
public static function multiExplode ( array $ delimiters , $ string ) { $ ready = str_replace ( $ delimiters , $ delimiters [ 0 ] , $ string ) ; return explode ( $ delimiters [ 0 ] , $ ready ) ; }
EXPLODE STRING BY ARRAY
230,635
public function addDefinition ( Definition $ definition ) { $ attribute = $ definition -> getAttribute ( ) ; $ key = $ definition -> getKey ( ) ; $ this -> mongoIndex [ $ key ] = $ attribute ; $ this -> definitions [ $ attribute ] = $ definition ; }
Add a definition
230,636
public function hasDefinition ( $ identifier ) { return isset ( $ this -> definitions [ $ identifier ] ) || isset ( $ this -> mongoIndex [ $ identifier ] ) ; }
Check whether a definition exists
230,637
public function getDefinition ( $ identifier ) { if ( isset ( $ this -> definitions [ $ identifier ] ) ) { return $ this -> definitions [ $ identifier ] ; } if ( isset ( $ this -> mongoIndex [ $ identifier ] ) ) { return $ this -> definitions [ $ this -> mongoIndex [ $ identifier ] ] ; } return null ; }
Return a definition
230,638
public function delete ( $ slug ) { if ( is_object ( $ slug ) && $ slug instanceof ModelObject ) $ slug = $ slug -> Slug ; $ this -> Events -> trigger ( get_class ( $ this ) . '.delete.pre' , $ this , $ slug ) ; $ this -> Events -> trigger ( 'AbstractSystemXMLDAO.delete.pre' , $ this , $ slug ) ; $ this -> loadSource (...
Removes the aspect and all the aspect relations
230,639
public function getByID ( $ id ) { if ( array_key_exists ( $ id , $ this -> idToSlugCache ) ) $ slug = $ this -> idToSlugCache [ $ id ] ; else $ slug = $ this -> SystemCache -> get ( $ this -> getModel ( ) -> getTableName ( ) . ':id:' . $ id ) ; if ( ! empty ( $ slug ) ) { return $ this -> getBySlug ( $ slug ) ; } $ th...
Returns the ModelObject containing the specified ID
230,640
public function findAll ( DTO $ dto ) { $ sd = get_class ( $ this ) . ( string ) serialize ( $ dto ) ; $ slugs = $ this -> SystemCache -> get ( $ sd ) ; if ( $ slugs === false ) { $ this -> loadSource ( ) ; $ slugs = array ( ) ; $ sort_array = array ( ) ; $ dir = 'ASC' ; $ orderbys = $ dto -> getOrderBys ( ) ; if ( ! e...
Finds Aspects .
230,641
public static function make ( $ name , array $ options = [ ] ) : self { $ class = new ReflectionClass ( $ options [ 'class' ] ?? static :: class ) ; $ instance = $ class -> newInstanceWithoutConstructor ( ) ; $ instance -> setName ( $ name ) ; $ instance -> setOptions ( $ options ) ; return $ instance ; }
Make control .
230,642
public function getBehavior ( $ name ) { $ this -> ensureBehaviors ( ) ; return isset ( $ this -> __behaviors__ [ $ name ] ) ? $ this -> __behaviors__ [ $ name ] : null ; }
Returns the named behavior object .
230,643
public function detachBehaviors ( ) { $ this -> ensureBehaviors ( ) ; foreach ( $ this -> __behaviors__ as $ name => $ behavior ) { $ this -> detachBehavior ( $ name ) ; } }
Detaches all behaviors from the component .
230,644
public function compare ( Schema $ oldSchema , Schema $ newSchema ) { $ createdTables = $ this -> getCreatedTables ( $ oldSchema , $ newSchema ) ; $ alteredTables = $ this -> getAlteredTables ( $ oldSchema , $ newSchema ) ; $ droppedTables = $ this -> getDroppedTables ( $ oldSchema , $ newSchema ) ; $ this -> detectRen...
Compares two schemas .
230,645
public function compareSequences ( Sequence $ oldSequence , Sequence $ newSequence ) { return ( $ oldSequence -> getName ( ) !== $ newSequence -> getName ( ) ) || ( $ oldSequence -> getInitialValue ( ) !== $ newSequence -> getInitialValue ( ) ) || ( $ oldSequence -> getIncrementSize ( ) !== $ newSequence -> getIncremen...
Compares two sequences .
230,646
public function compareViews ( View $ oldView , View $ newView ) { return ( $ oldView -> getName ( ) !== $ newView -> getName ( ) ) || ( $ oldView -> getSQL ( ) !== $ newView -> getSQL ( ) ) ; }
Compares two views .
230,647
private function detectRenamedTables ( array & $ createdTables , array & $ droppedTables , array & $ alteredTables ) { foreach ( $ createdTables as $ createdIndex => $ createdTable ) { foreach ( $ droppedTables as $ droppedIndex => $ droppedTable ) { $ tableDiff = $ this -> tableComparator -> compare ( $ droppedTable ,...
Detects and rewrites renamed tables .
230,648
private function transformToXml ( $ data = [ ] , $ hypertextRoutes = [ ] , $ depth = 0 ) { $ xml = '' ; if ( $ depth === 0 ) { $ xml = "<?xml version=\"1.0\"?>\n" ; $ xml .= "<response>\n" ; } if ( ! is_array ( $ data ) ) { return "<?xml version=\"1.0\"?>\n<response>{$data}{$this->getHypertextXml($hypertextRoutes)}</re...
Recursively converts the response into an xml string .
230,649
private function getHypertextXml ( $ routes = [ ] ) { if ( ! $ routes ) { return '' ; } $ xml = '' ; foreach ( $ routes as $ name => $ route ) { $ xml .= "<link rel=\"{$name}\" href=\"{$route}\"/>\n" ; } return $ xml ; }
Generates the xml for the hypertext routes .
230,650
public static function url ( string $ name , ? array $ parameters = [ ] ) { $ url = null ; foreach ( Swish :: $ routes as $ route ) { if ( $ route [ 'name' ] == $ name ) { $ url = $ route [ 'pattern' ] ; if ( $ route [ 'required' ] > 0 && ( $ route [ 'required' ] == count ( $ parameters ) ) ) { foreach ( $ parameters a...
Generate url from route
230,651
public function stream_open ( $ path , $ mode , $ options , & $ opened_path ) { $ this -> path = $ path ; $ this -> resource = fopen ( $ this -> getLocalFilesystemPath ( $ path ) , $ mode ) ; return is_resource ( $ this -> resource ) ; }
Let s create a stream . No file writing necessary here
230,652
public function unlink ( $ path ) { if ( isset ( static :: $ pointer_tree [ $ path_to ] ) ) { if ( is_resource ( static :: $ pointer_tree [ $ path_to ] ) ) fclose ( static :: $ pointer_tree [ $ path_to ] ) ; unset ( static :: $ pointer_tree [ $ path_to ] ) ; } return true ; }
Remove file from interface
230,653
protected function getLocalFilesystemPath ( $ path ) { if ( ! isset ( static :: $ pointer_tree [ $ path ] ) ) static :: $ pointer_tree [ $ path ] = tmpfile ( ) ; if ( $ metadata = stream_get_meta_data ( static :: $ pointer_tree [ $ path ] ) ) return $ metadata [ "uri" ] ; return null ; }
Returns an instance of a resource based on something
230,654
public static function loop ( array $ array , $ string , $ betweenStrings = PHP_EOL ) { $ output = [ ] ; foreach ( $ array as $ key => $ value ) { $ output [ ] = static :: parseString ( $ string , array_map ( 'addslashes' , static :: array_dot ( $ value ) ) ) ; } return implode ( $ betweenStrings , $ output ) ; }
Loop through an array and prints for every element the string
230,655
protected function configureShowFields ( ShowMapper $ mapper ) { $ this -> configShowHandlesRelations ( $ mapper ) ; $ this -> configureShowDescriptions ( $ mapper ) ; if ( $ this -> getSubject ( ) ) { if ( $ this -> getSubject ( ) -> getIsStrain ( ) ) { $ tabs = $ mapper -> getadmin ( ) -> getShowTabs ( ) ; unset ( $ ...
Configure Show view fields .
230,656
public function prePersist ( $ variety ) { parent :: prePersist ( $ variety ) ; if ( $ variety -> getParent ( ) ) { if ( $ variety -> getParent ( ) -> getId ( ) == $ variety -> getId ( ) ) { $ variety -> setParent ( null ) ; } } }
prevent primary key loop
230,657
public function register ( ServiceProviderInterface $ provider , $ settings = [ ] ) { $ provider -> register ( $ this ) ; foreach ( $ settings as $ key => $ value ) { $ this -> set ( $ key , $ value ) ; } return $ this ; }
Register a service provider a la Pimple
230,658
public function extend ( $ id , $ definition ) { if ( ! isset ( $ this -> extensions [ $ id ] ) ) { $ this -> extensions = [ ] ; } $ this -> extensions [ $ id ] [ ] = $ definition ; }
Extend a service
230,659
protected function setDefinition ( $ id , $ definition , $ shared = false ) { $ this -> definitions [ $ id ] = $ definition ; if ( true === $ shared ) { $ this -> shared [ $ id ] = $ id ; } }
Set a definition in the container
230,660
protected function orderBundles ( ) { $ order = array ( ) ; foreach ( $ this -> overridedBundles as $ overriderBundle => $ overridedBundles ) { if ( ! array_key_exists ( $ overriderBundle , $ order ) ) $ order [ $ overriderBundle ] = 0 ; foreach ( $ overridedBundles as $ overriderBundle => $ overridedBundle ) { if ( ar...
Orders the bundles according to bundle s json param overrided
230,661
protected function arrangeBundlesForEnvironment ( ) { foreach ( $ this -> autoloaderCollection as $ autoloader ) { $ autoloaderBundles = $ autoloader -> getBundles ( ) ; foreach ( $ autoloaderBundles as $ environment => $ bundles ) { foreach ( $ bundles as $ bundle ) { $ this -> environmentsBundles [ $ environment ] [ ...
Parsers the autoloaders and arranges the bundles for environment
230,662
protected function install ( ) { $ installScripts = array ( ) ; foreach ( $ this -> autoloaderCollection as $ dir => $ jsonAutoloader ) { $ bundleName = $ jsonAutoloader -> getBundleName ( ) ; $ this -> installPackage ( $ dir , $ jsonAutoloader ) ; $ actionsManager = $ jsonAutoloader -> getActionManager ( ) ; if ( ( ! ...
Instantiates the bundles that must be autoconfigured parsing the autoload_namespaces . php file generated by composer
230,663
protected function installPackage ( $ sourceFolder , JsonAutoloader $ autoloader ) { $ bundleName = $ autoloader -> getBundleName ( ) ; if ( array_key_exists ( 'all' , $ autoloader -> getBundles ( ) ) || array_key_exists ( $ this -> environment , $ autoloader -> getBundles ( ) ) ) { $ target = $ this -> autoloadersPath...
Installs the autoloader . json the routing and config files
230,664
protected function retrieveInstalledBundles ( ) { $ finder = new Finder ( ) ; $ autoloaders = $ finder -> files ( ) -> depth ( 0 ) -> name ( '*.json' ) -> in ( $ this -> autoloadersPath ) ; foreach ( $ autoloaders as $ autoloader ) { $ bundleName = strtolower ( basename ( $ autoloader -> getFilename ( ) , '.json' ) ) ;...
Retrieves the current installed bundles
230,665
protected function getBundleName ( $ path ) { if ( is_dir ( $ path ) ) { $ finder = new Finder ( ) ; $ bundles = $ finder -> files ( ) -> depth ( 0 ) -> name ( '*Bundle.php' ) -> in ( $ path ) ; foreach ( $ bundles as $ bundle ) { return basename ( $ bundle -> getFilename ( ) , 'Bundle.php' ) ; } } return null ; }
Retrieves the current bundle class
230,666
protected function copy ( $ source , $ target ) { if ( is_file ( $ source ) ) { $ exists = is_file ( $ target ) ? true : false ; $ this -> filesystem -> copy ( $ source , $ target ) ; if ( ! $ exists ) { return true ; } } return false ; }
Copies the source file
230,667
private function setupFolders ( ) { $ this -> basePath = $ this -> kernelDir . '/config/bundles' ; $ this -> autoloadersPath = $ this -> basePath . '/autoloaders' ; $ this -> configPath = $ this -> basePath . '/config' ; $ this -> routingPath = $ this -> basePath . '/routing' ; $ this -> cachePath = $ this -> basePath ...
Sets up the paths and creates the folder if they not exist
230,668
private function requireCachedClasses ( ) { $ classPath = $ this -> cachePath ; if ( is_dir ( $ classPath ) ) { $ finder = new Finder ( ) ; $ actionManagerFiles = $ finder -> files ( ) -> depth ( 1 ) -> name ( '*.php' ) -> in ( $ classPath ) ; foreach ( $ actionManagerFiles as $ actionManagerFile ) { $ classFileName = ...
Requires the cached classes when needed
230,669
public function getRoutes ( ) { $ list = array ( ) ; foreach ( glob ( __DIR__ . '/config/commands/*.php' ) as $ file ) { $ command = pathinfo ( $ file , PATHINFO_FILENAME ) ; $ list [ $ command ] = gplcart_config_get ( $ file ) ; $ method = $ command ; $ parts = explode ( '-' , $ command ) ; if ( count ( $ parts ) > 1 ...
Returns an array of supported command routes
230,670
public function set ( string $ id , $ service ) { if ( $ this -> frozen ) { throw new FrozenContainerException ( "The container is frozen and is not possible to define the new service \"{$id}\"." ) ; } $ this -> definitions [ $ id ] = $ service ; unset ( $ this -> services [ $ id ] ) ; unset ( $ this -> aliases [ $ id ...
Defines a new service .
230,671
public function alias ( string $ alias , string $ original ) { $ this -> aliases [ $ alias ] = $ this -> getRealId ( $ original ) ; return $ this ; }
Sets an alias for a service .
230,672
public function getNew ( string $ id ) { $ definition = $ this -> raw ( $ id ) ; if ( is_callable ( $ definition ) ) { $ service = call_user_func ( $ definition , $ this ) ; } else { $ service = $ definition ; } if ( isset ( $ this -> extensionQueues [ $ id ] ) ) { $ service = $ this -> extensionQueues [ $ id ] -> getS...
Forces the container to return a new instance of the service .
230,673
public function raw ( string $ id ) { $ id = $ this -> getRealId ( $ id ) ; if ( array_key_exists ( $ id , $ this -> definitions ) ) { return $ this -> definitions [ $ id ] ; } throw new Exception \ NotFoundException ( $ id ) ; }
Gets the raw definition of the service .
230,674
private function getReflectionInstance ( ) { if ( \ is_array ( $ this -> controller ) && 2 === \ count ( $ this -> controller ) ) { return new \ ReflectionMethod ( $ this -> controller [ 0 ] , $ this -> controller [ 1 ] ) ; } if ( \ is_object ( $ this -> controller ) && ! $ this -> controller instanceof \ Closure ) { $...
To generate the \ Reflection object dedicated to the controller . The controller is a callable so it can be a method of an object a invokable object or a function .
230,675
private function extractArguments ( ) : array { $ parameters = [ ] ; foreach ( $ this -> getReflectionInstance ( ) -> getParameters ( ) as $ param ) { $ name = $ param -> getName ( ) ; $ hasDefault = $ param -> isDefaultValueAvailable ( ) ; $ defaultValue = null ; if ( true === $ hasDefault ) { $ defaultValue = $ param...
To extract controller s parameter from \ Reflection Api and convert into ParameterInterface instance .
230,676
public function getHeadersString ( \ Psr \ Http \ Message \ ResponseInterface $ psr7response ) { $ strHeaders = '' ; if ( $ psr7response === null ) { return $ strHeaders ; } $ arrHeaders = $ psr7response -> getHeaders ( ) ; if ( ! is_array ( $ arrHeaders ) || count ( $ arrHeaders ) < 1 ) { return '' ; } foreach ( $ arr...
Get psr7 headers array and return string representation .
230,677
public function actionAuthorize ( ) { $ model = new LoginForm ( ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> login ( ) ) { if ( $ this -> isOauthRequest ) { $ this -> finishAuthorization ( ) ; } else { return $ this -> goBack ( ) ; } } else { $ this -> layout = false ; return $ this ->...
Display login form signup or something else . AuthClients such as Google also may be used
230,678
public function successCallback ( $ client ) { $ account = Social :: find ( ) -> byClient ( $ client ) -> one ( ) ; if ( $ account === null ) { $ account = Social :: create ( $ client ) ; } if ( $ account -> user instanceof Yii :: $ app -> user -> id ) { if ( $ account -> user -> isBlocked ) { Yii :: $ app -> session -...
OPTIONAL Third party oauth callback sample
230,679
public function generate ( DocumentManager $ dm , $ document ) { $ UUID = $ this -> generateV4 ( ) ; return $ this -> generateV5 ( $ UUID , $ this -> salt ? : php_uname ( 'n' ) ) ; }
Generate a new UUID .
230,680
public static function encodeCreateTable ( $ tableName , $ fields ) { $ query = "CREATE TABLE IF NOT EXISTS $tableName (" ; $ keys = array_keys ( $ fields ) ; $ size = sizeof ( $ keys ) ; foreach ( $ keys as $ index => $ field ) { $ query .= " $field" ; $ attribs = $ fields [ $ field ] ; foreach ( $ attribs as $ i => $...
Creates a create table sql statement
230,681
public static function encodeInsertRecord ( $ tableName , $ newRecord ) { $ query = "INSERT INTO $tableName VALUES (" ; $ size = sizeof ( $ newRecord ) ; foreach ( $ newRecord as $ index => $ record ) { $ query .= " '$record'" ; if ( $ index != ( $ size - 1 ) ) $ query .= " ," ; } $ query .= " );" ; return $ query ; }
Creates a insert record SQL statement
230,682
public static function encodeGetRecord ( $ tableName , $ field , $ value , $ fields = array ( ) ) { $ select = "" ; $ size = sizeof ( $ fields ) ; if ( sizeof ( $ fields ) > 0 ) { foreach ( $ fields as $ i => $ column ) { $ select .= " $column" ; if ( $ i != ( $ size - 1 ) ) $ select .= "," ; } } else { $ select = "*" ...
Encodes get record statement
230,683
public static function encodeUpdateRecord ( $ tableName , $ fields , $ values , $ field , $ value ) { $ query = "UPDATE $tableName SET" ; $ size = sizeof ( $ fields ) ; foreach ( $ fields as $ i => $ column ) { $ query .= " $column = '$values[$i]'" ; if ( $ i != ( $ size - 1 ) ) $ query .= "," ; } $ query .= " WHERE $f...
Encodes the params to an SQL statement
230,684
public static function encodeGetAllRecords ( $ tableName , $ fields = array ( ) , $ limit = 0 , $ start = 0 ) { if ( $ fields == null ) $ fields = array ( ) ; $ select = "" ; $ size = sizeof ( $ fields ) ; if ( sizeof ( $ fields ) > 0 ) { foreach ( $ fields as $ i => $ column ) { $ select .= " $column" ; if ( $ i != ( ...
Encode Get all record to SQL statement
230,685
public function add ( $ value = null , $ key = '' ) { if ( $ this -> isClass ) { if ( ! is_a ( $ value , $ this -> type ) ) { $ type = is_object ( $ value ) ? get_class ( $ value ) : gettype ( $ value ) ; throw new TypeCheckException ( 'Object type "' . $ type . '" is not of type "' . $ this -> type . '".' ) ; } else {...
Add value to collection .
230,686
public static function hasChildren ( $ postRepository , $ language , $ postId ) { $ menuCount = $ postRepository -> countBy ( array ( 'lang' => $ language , 'parent' => $ postId ) ) ; if ( $ menuCount > 0 ) { return true ; } return false ; }
Returns bool value whether item is containing children .
230,687
public static function getChildren ( $ postRepository , $ language , $ postId , $ activeId = 0 , $ getUnpublished = true ) { $ menuObject = array ( ) ; $ requirements = array ( 'lang' => $ language , 'parent' => $ postId , ) ; if ( ! $ getUnpublished ) { $ requirements [ 'is_public' ] = 1 ; } $ subItems = $ postReposit...
Returns array filled with MenuItem objects
230,688
public static function findByNameSliderId ( $ name , $ sliderId ) { return Slide :: find ( ) -> where ( 'sliderId=:id' , [ ':id' => $ sliderId ] ) -> andwhere ( 'name=:name' , [ ':name' => $ name ] ) -> one ( ) ; }
Find and return the slide associated with given name and slider id .
230,689
public static function isExistByNameSliderId ( $ name , $ sliderId ) { $ slide = self :: findByNameSliderId ( $ name , $ sliderId ) ; return isset ( $ slide ) ; }
Check whether slide exist by name and slider id .
230,690
public function setKeyPair ( KeyPairLoaderInterface $ keyPairLoader ) { $ this -> privateKey = $ keyPairLoader -> getPrivateKey ( ) ; $ this -> publicKey = $ keyPairLoader -> getPublicKey ( ) ; }
Set key pair
230,691
public function is ( Hierarchy $ element ) { if ( get_class ( $ this ) !== get_class ( $ element ) ) return false ; return $ this -> id === $ element -> id ; }
Check if the objects are referring to the same element .
230,692
public function isAncestorOf ( Hierarchy $ element , LoaderInterface $ loader = null ) { return $ loader !== null ? $ element -> isOffspringOf ( $ this , $ loader ) : $ element -> isOffspringOf ( $ this ) ; }
Check if the current element is an ancestor of the specified element
230,693
public function isOffspringOf ( Hierarchy $ element , LoaderInterface $ loader = null ) { if ( get_class ( $ element ) !== get_class ( $ this ) ) return 0 ; $ stack = [ ] ; $ parents = $ this -> getParents ( $ loader ) ; foreach ( $ parents as $ p ) $ stack [ ] = [ 1 , $ p ] ; $ seen = [ ] ; $ level = 0 ; while ( ! emp...
Check if the current element is offspring of the specified element
230,694
public function getParents ( LoaderInterface $ loader = null ) { if ( empty ( $ this -> parents ) && $ this -> id !== static :: $ root ) $ this -> parents = [ $ this -> getRoot ( ) ] ; $ acl = $ this -> getACL ( ) ; if ( null === $ acl ) throw new \ RuntimeException ( "ACL is null on " . get_class ( $ this ) ) ; $ pare...
Return a list of all parent elements of this element
230,695
public function setParents ( array $ parents ) { $ ownclass = get_class ( $ this ) ; $ is_root = ( $ this -> id === static :: $ root ) ; $ this -> parents = array ( ) ; foreach ( $ parents as $ parent ) { if ( is_object ( $ parent ) && get_class ( $ parent ) == $ ownclass ) $ this -> parents [ $ parent -> id ] = $ pare...
Set the parent or parents of this element
230,696
protected function sdk ( ) { if ( empty ( $ this -> oSdk ) ) { $ this -> oSdk = new \ Aws \ S3 \ S3Client ( [ 'version' => 'latest' , 'region' => $ this -> getRegion ( ) , 'credentials' => new \ Aws \ Credentials \ Credentials ( $ this -> getSetting ( 'access_key' ) , $ this -> getSetting ( 'access_secret' ) ) , ] ) ; ...
Returns an instance of the AWS S3 SDK
230,697
protected function getBucket ( ) { if ( empty ( $ this -> sS3Bucket ) ) { $ this -> sS3Bucket = $ this -> getRegionAndBucket ( ) -> bucket ; if ( empty ( $ this -> sS3Bucket ) ) { throw new DriverException ( 'S3 Bucket has not been defined.' ) ; } } return $ this -> sS3Bucket ; }
Returns the AWS bucket for this environment
230,698
protected function getRegion ( ) { if ( empty ( $ this -> sS3Region ) ) { $ this -> sS3Region = $ this -> getRegionAndBucket ( ) -> region ; if ( empty ( $ this -> sS3Region ) ) { throw new DriverException ( 'S3 Region has not been defined.' ) ; } } return $ this -> sS3Region ; }
Returns the AWS region for this environment
230,699
protected function getRegionAndBucket ( ) { $ aSpaces = json_decode ( $ this -> getSetting ( 'buckets' ) , true ) ; if ( empty ( $ aSpaces ) ) { throw new DriverException ( 'S3 Buckets have not been defined.' ) ; } elseif ( empty ( $ aSpaces [ Environment :: get ( ) ] ) ) { throw new DriverException ( 'No bucket define...
Extracts the Region and Bucket from the configs