idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
49,700 | 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 |
49,701 | final protected static function occurred ( array $ payload , ? TimeProvider $ timeProvider = null ) { $ timeProvider = $ timeProvider ?? new SystemTimeProvider ( ) ; return new static ( $ payload , $ timeProvider -> getCurrentTime ( ) ) ; } | Instantiate new event . |
49,702 | 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 |
49,703 | public function get ( $ sSlug ) { $ aSkins = $ this -> getAll ( ) ; foreach ( $ aSkins as $ oSkin ) { if ( $ oSkin -> slug == $ sSlug ) { return $ oSkin ; } } return false ; } | Gets a single skin |
49,704 | public static function multiExplode ( array $ delimiters , $ string ) { $ ready = str_replace ( $ delimiters , $ delimiters [ 0 ] , $ string ) ; return explode ( $ delimiters [ 0 ] , $ ready ) ; } | EXPLODE STRING BY ARRAY |
49,705 | public function addDefinition ( Definition $ definition ) { $ attribute = $ definition -> getAttribute ( ) ; $ key = $ definition -> getKey ( ) ; $ this -> mongoIndex [ $ key ] = $ attribute ; $ this -> definitions [ $ attribute ] = $ definition ; } | Add a definition |
49,706 | public function hasDefinition ( $ identifier ) { return isset ( $ this -> definitions [ $ identifier ] ) || isset ( $ this -> mongoIndex [ $ identifier ] ) ; } | Check whether a definition exists |
49,707 | 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 |
49,708 | 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 |
49,709 | 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 |
49,710 | 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 . |
49,711 | 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 . |
49,712 | public function getBehavior ( $ name ) { $ this -> ensureBehaviors ( ) ; return isset ( $ this -> __behaviors__ [ $ name ] ) ? $ this -> __behaviors__ [ $ name ] : null ; } | Returns the named behavior object . |
49,713 | public function detachBehaviors ( ) { $ this -> ensureBehaviors ( ) ; foreach ( $ this -> __behaviors__ as $ name => $ behavior ) { $ this -> detachBehavior ( $ name ) ; } } | Detaches all behaviors from the component . |
49,714 | 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 . |
49,715 | public function compareSequences ( Sequence $ oldSequence , Sequence $ newSequence ) { return ( $ oldSequence -> getName ( ) !== $ newSequence -> getName ( ) ) || ( $ oldSequence -> getInitialValue ( ) !== $ newSequence -> getInitialValue ( ) ) || ( $ oldSequence -> getIncrementSize ( ) !== $ newSequence -> getIncremen... | Compares two sequences . |
49,716 | public function compareViews ( View $ oldView , View $ newView ) { return ( $ oldView -> getName ( ) !== $ newView -> getName ( ) ) || ( $ oldView -> getSQL ( ) !== $ newView -> getSQL ( ) ) ; } | Compares two views . |
49,717 | 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 . |
49,718 | 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 . |
49,719 | 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 . |
49,720 | 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 |
49,721 | 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 |
49,722 | 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 |
49,723 | 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 |
49,724 | 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 |
49,725 | 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 . |
49,726 | public function prePersist ( $ variety ) { parent :: prePersist ( $ variety ) ; if ( $ variety -> getParent ( ) ) { if ( $ variety -> getParent ( ) -> getId ( ) == $ variety -> getId ( ) ) { $ variety -> setParent ( null ) ; } } } | prevent primary key loop |
49,727 | 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 |
49,728 | public function extend ( $ id , $ definition ) { if ( ! isset ( $ this -> extensions [ $ id ] ) ) { $ this -> extensions = [ ] ; } $ this -> extensions [ $ id ] [ ] = $ definition ; } | Extend a service |
49,729 | protected function setDefinition ( $ id , $ definition , $ shared = false ) { $ this -> definitions [ $ id ] = $ definition ; if ( true === $ shared ) { $ this -> shared [ $ id ] = $ id ; } } | Set a definition in the container |
49,730 | 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 |
49,731 | 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 |
49,732 | 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 |
49,733 | 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 |
49,734 | 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 |
49,735 | 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 |
49,736 | 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 |
49,737 | 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 |
49,738 | 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 |
49,739 | 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 |
49,740 | 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 . |
49,741 | public function alias ( string $ alias , string $ original ) { $ this -> aliases [ $ alias ] = $ this -> getRealId ( $ original ) ; return $ this ; } | Sets an alias for a service . |
49,742 | 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 . |
49,743 | 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 . |
49,744 | 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 . |
49,745 | 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 . |
49,746 | 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 . |
49,747 | 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 |
49,748 | 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 |
49,749 | public function generate ( DocumentManager $ dm , $ document ) { $ UUID = $ this -> generateV4 ( ) ; return $ this -> generateV5 ( $ UUID , $ this -> salt ? : php_uname ( 'n' ) ) ; } | Generate a new UUID . |
49,750 | 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 |
49,751 | 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 |
49,752 | 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 |
49,753 | 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 |
49,754 | 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 |
49,755 | 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 . |
49,756 | 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 . |
49,757 | 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 |
49,758 | 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 . |
49,759 | public static function isExistByNameSliderId ( $ name , $ sliderId ) { $ slide = self :: findByNameSliderId ( $ name , $ sliderId ) ; return isset ( $ slide ) ; } | Check whether slide exist by name and slider id . |
49,760 | public function setKeyPair ( KeyPairLoaderInterface $ keyPairLoader ) { $ this -> privateKey = $ keyPairLoader -> getPrivateKey ( ) ; $ this -> publicKey = $ keyPairLoader -> getPublicKey ( ) ; } | Set key pair |
49,761 | 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 . |
49,762 | 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 |
49,763 | 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 |
49,764 | 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 |
49,765 | 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 |
49,766 | 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 |
49,767 | 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 |
49,768 | 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 |
49,769 | 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 |
49,770 | public function rebuild ( $ force = false ) { $ alreadyValid = forward_static_call ( [ get_class ( $ this -> model ) , 'isValidNestedSet' ] ) ; if ( ! $ force && $ alreadyValid ) return true ; $ self = $ this ; $ this -> model -> getConnection ( ) -> transaction ( function ( ) use ( $ self ) { foreach ( $ self -> roots... | Perform the re - calculation of the left and right indexes of the whole nested set tree structure . |
49,771 | public function roots ( ) { return $ this -> model -> newQuery ( ) -> whereNull ( $ this -> model -> getQualifiedParentColumnName ( ) ) -> orderBy ( $ this -> model -> getQualifiedLeftColumnName ( ) ) -> orderBy ( $ this -> model -> getQualifiedRightColumnName ( ) ) -> orderBy ( $ this -> model -> getQualifiedKeyName (... | Return all root nodes for the current database table appropiately sorted . |
49,772 | public function children ( $ model ) { $ query = $ this -> model -> newQuery ( ) ; $ query -> where ( $ this -> model -> getQualifiedParentColumnName ( ) , '=' , $ model -> getKey ( ) ) ; foreach ( $ this -> scopedAttributes ( $ model ) as $ fld => $ value ) $ query -> where ( $ this -> qualify ( $ fld ) , '=' , $ valu... | Return all children for the specified node . |
49,773 | protected function scopedAttributes ( $ model ) { $ keys = $ this -> model -> getScopedColumns ( ) ; if ( count ( $ keys ) == 0 ) return [ ] ; $ values = array_map ( function ( $ column ) use ( $ model ) { return $ model -> getAttribute ( $ column ) ; } , $ keys ) ; return array_combine ( $ keys , $ values ) ; } | Return an array of the scoped attributes of the supplied node . |
49,774 | public static function createUserFromPostValues ( $ postValues ) { if ( isset ( $ postValues [ 'username' ] ) ) { $ user = new \ stdClass ( ) ; $ user -> username = $ postValues [ 'username' ] ; $ user -> slug = StringUtil :: slugify ( $ postValues [ 'username' ] ) ; $ user -> rights = array ( ) ; if ( isset ( $ postVa... | Create user from POST values |
49,775 | public function actionSave ( $ id = null , $ languageId ) { if ( ! empty ( $ languageId ) ) { if ( ! empty ( $ id ) ) { $ model = $ this -> findModel ( $ id ) ; } else { $ model = new OrderStatus ( ) ; } $ modelTranslation = $ this -> findOrCreateModelTranslation ( $ model -> id , $ languageId ) ; if ( $ modelTranslati... | Creates a new or updates existing OrderStatus and OrderStatusTranslation models . If creation is successful the browser will be redirected to the view page . |
49,776 | public function actionDelete ( $ id ) { if ( ! empty ( $ id ) ) { if ( $ id != OrderStatus :: STATUS_INCOMPLETE && $ id != OrderStatus :: STATUS_CONFIRMED ) { $ status = $ this -> findModel ( $ id ) ; if ( ! empty ( $ status ) ) { \ Yii :: $ app -> session -> setFlash ( 'success' , Yii :: t ( 'cart' , 'The status was s... | Deletes an existing OrderStatus model . If deletion is successful the browser will be redirected to the index page . |
49,777 | protected function findOrCreateModelTranslation ( $ id , $ languageId ) { $ modelTranslations = OrderStatusTranslation :: find ( ) -> where ( [ 'order_status_id' => $ id , 'language_id' => $ languageId ] ) -> one ( ) ; return ( ! empty ( $ modelTranslations ) ) ? $ modelTranslations : new OrderStatusTranslation ( ) ; } | Finds the OrderStatusTranslation model based on order_status_id property . If the model is not found a new model will be created . |
49,778 | public static function createFromServerRequest ( ServerRequest $ serverRequest ) { return new Request ( $ serverRequest -> getMethod ( ) , $ serverRequest -> getUri ( ) , $ serverRequest -> getHeaders ( ) , $ serverRequest -> getBody ( ) , $ serverRequest -> getProtocolVersion ( ) ) ; } | Build Request from a server Request . |
49,779 | private function replaceHostHeader ( UriInterface $ uri ) { $ host = $ uri -> getHost ( ) ; if ( ! empty ( $ host ) ) { $ port = $ uri -> getPort ( ) ; if ( ! empty ( $ port ) ) { $ host .= ':' . $ port ; } $ this -> headersOriginal = [ 'Host' => [ $ host ] ] + $ this -> headersOriginal ; $ this -> headers = [ 'host' =... | Update host header if host is not empty . |
49,780 | public function unserialize ( $ serialized ) { $ string = unserialize ( $ serialized , [ ] ) ; $ this -> data = RamseyUUID :: fromString ( $ string ) ; } | Restore the object from serialized data . |
49,781 | public function getClass ( ) { if ( is_string ( $ this -> fn ) ) { return $ this -> fn ; } $ hash = sha1 ( mt_rand ( ) . microtime ( true ) ) ; return "sndsgd\\field\\rule\\Closure($hash)" ; } | Ensure that multiple Closure rules can be added to a field |
49,782 | protected function getAssets ( array $ config ) { $ bootstrapBasePath = $ config [ 'bootstrap' ] [ 'dist_path' ] ; $ assets = array ( 'symboo_bootstrap_css' => array ( 'inputs' => array ( $ bootstrapBasePath . '/css/bootstrap.min.css' ) , 'filters' => array ( 'cssrewrite' ) , 'output' => 'css/bootstrap.css' ) , 'symboo... | Returns the assets to be added |
49,783 | public function boot ( ) { $ this -> publishes ( [ dirname ( dirname ( __DIR__ ) ) . '/config/repositories.php' => config_path ( 'repositories.php' ) , ] ) ; foreach ( config ( 'repositories.repositories' , [ ] ) as $ respository_contract => $ repository ) { $ this -> app -> bind ( $ respository_contract , $ repository... | Register any repositories . |
49,784 | public static function executeInBackground ( Task $ task , $ progressReportedCallback = null , BackgroundTaskStatus $ persistentStatus = null ) { if ( ! $ persistentStatus ) { $ persistentStatus = new BackgroundTaskStatus ( ) ; $ persistentStatus -> TaskClass = get_class ( $ task ) ; $ persistentStatus -> save ( ) ; } ... | Executes a task and provisions a BackgroundTaskStatus model to store a persistent record of the state . |
49,785 | public static function buildQueryDelete ( QuoteInterface $ quoting , $ table , array $ data , array $ returning = null ) { if ( ! count ( $ data ) === 0 ) { throw new NothingToDoException ( "Nothing to generate." ) ; } $ keys = self :: keyTuple ( $ quoting , $ data ) ; $ tuples = self :: dataTuples ( $ data ) ; return ... | Delete query for a data array |
49,786 | public static function buildQueryUpdate ( QuoteInterface $ quoting , $ table , array $ primaryKeys , array $ data , array $ dataInitial , array $ returning = null ) { if ( ! count ( $ data ) === 0 ) { throw new NothingToDoException ( "Nothing to generate." ) ; } $ columnNames = array_keys ( $ data [ 0 ] ) ; $ columnNam... | Update query for a data array |
49,787 | protected static function getReturningClause ( QuoteInterface $ quoting , array $ returning = null , $ table = '' ) { if ( $ returning === null ) { return 'RETURNING *' ; } elseif ( $ returning === array ( ) ) { return '' ; } elseif ( ! empty ( $ table ) ) { foreach ( $ returning as & $ value ) { $ value = "{$table}.{$... | Turn a array of columns into a comma separated identifier list suitable for being passed into a RETURNING |
49,788 | protected static function validateQueryDatas ( array & $ datas , array $ modifiers ) { foreach ( $ datas as $ key => & $ data ) { self :: validateQueryData ( $ data , $ modifiers ) ; } } | Validate a array of query datas arrays |
49,789 | protected static function validateQueryData ( array & $ data , array $ modifiers ) { foreach ( $ data as $ column => & $ value ) { $ value = $ modifiers [ $ column ] -> exec ( $ value ) ; } } | Validate a query datas array |
49,790 | protected static function buildChainTasks ( \ Bond \ Entity \ Base $ entity , $ columns ) { $ tasks = array ( ) ; foreach ( $ columns as $ column ) { $ value = $ entity -> get ( $ column ) ; if ( is_object ( $ value ) and $ value instanceof ChainSavingInterface ) { $ value -> chainSaving ( $ tasks , $ column ) ; } } re... | Get chain tasks |
49,791 | protected function itemSupportsMethodCall ( IsMetInterface $ item , $ methodName ) { $ hash = spl_object_hash ( $ item ) ; if ( empty ( $ this -> methodNamesPerItem ) || ! isset ( $ this -> methodNamesPerItem [ $ hash ] ) ) { $ itemMethods = array_flip ( get_class_methods ( $ item ) ) ; $ this -> methodNamesPerItem [ $... | Checks if item implements method name |
49,792 | public function registerVertex ( Vertex $ vertex ) { $ this -> vertexes -> set ( $ vertex -> getName ( ) , $ vertex ) ; return $ this ; } | register a new vertex into metadata |
49,793 | protected static function getSuppliedCSRF ( ) { $ headers = function_exists ( 'getallheaders' ) === true ? getallheaders ( ) : [ ] ; $ requestArguments = [ ] ; parse_str ( file_get_contents ( 'php://input' ) , $ requestArguments ) ; $ requestArguments = array_merge ( $ _POST , $ requestArguments ) ; if ( array_key_exis... | Get the CSRF token presented as a header a PUT parameter or a POST parameter . |
49,794 | public function importFile ( $ localPath , FileInterface $ folder = null ) { if ( ! $ folder -> isDir ( ) ) { throw new RuntimeException ( 'Files can only be moved into directories' ) ; } $ fileName = basename ( $ localPath ) ; $ targetPath = $ folder ? $ folder -> getPath ( ) . "$fileName" : $ fileName ; $ this -> fil... | Import a local file into the FileDB |
49,795 | protected function validateTimestamps ( array $ payload ) { if ( isset ( $ payload [ 'nbf' ] ) && Utils :: timestamp ( $ payload [ 'nbf' ] ) -> isFuture ( ) ) { throw new TokenInvalidException ( 'Not Before (nbf) timestamp cannot be in the future' , 400 ) ; } if ( isset ( $ payload [ 'iat' ] ) && Utils :: timestamp ( $... | Validate the payload timestamps . |
49,796 | public function accountPv ( \ Magento \ Sales \ Api \ Data \ OrderInterface $ order ) { $ orderId = $ order -> getEntityId ( ) ; $ this -> updateDatePaid ( $ orderId ) ; $ req = new \ Praxigento \ Pv \ Api \ Service \ Sale \ Account \ Pv \ Request ( ) ; $ req -> setSaleOrderId ( $ orderId ) ; $ this -> srvPvAccount -> ... | Collect order data and call service method to transfer PV to customer account . |
49,797 | private function getServiceItemForMageItem ( \ Magento \ Sales \ Api \ Data \ OrderItemInterface $ item , $ stockId = null ) { $ result = new \ Praxigento \ Pv \ Service \ Sale \ Data \ Item ( ) ; $ prodId = $ item -> getProductId ( ) ; $ itemId = $ item -> getItemId ( ) ; $ qty = $ item -> getQtyOrdered ( ) ; $ result... | Convert Magento SaleOrderItem to service item . |
49,798 | public function savePv ( \ Magento \ Sales \ Api \ Data \ OrderInterface $ order ) { $ orderId = $ order -> getId ( ) ; $ state = $ order -> getState ( ) ; $ dateCreated = $ order -> getCreatedAt ( ) ; $ itemsData = $ this -> getServiceItemsForMageSaleOrder ( $ order ) ; $ req = new \ Praxigento \ Pv \ Service \ Sale \... | Collect orders data and call service method to register order PV . |
49,799 | private function updateDatePaid ( $ orderId ) { $ datePaid = $ this -> hlpDate -> getUtcNowForDb ( ) ; $ data = [ ESale :: A_DATE_PAID => $ datePaid ] ; $ this -> daoSale -> updateById ( $ orderId , $ data ) ; $ this -> logger -> info ( "Update paid date in PV registry when sale order (#$orderId) is paid." ) ; } | Update paid date in sale order registry of PV module . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.