idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
10,800
protected function loadJsonConfigFile ( string $ fileKey , string $ filePath ) { $ json = file_get_contents ( $ filePath ) ; $ config = json_decode ( $ json ) ; if ( $ config === null ) { throw new Exception ( json_last_error_msg ( ) , $ this :: ERR_JSON_PARSE ) ; } $ this -> config [ $ fileKey ] = $ config ; }
Load a json config file
10,801
public function getValue ( string $ key , string $ file = null ) { $ nbConfigFile = count ( $ this -> config ) ; if ( $ file === null && $ nbConfigFile > 1 ) { throw new Exception ( 'There are many config files. Please indicate the file to' . ' obtain the config ' . $ key , $ this :: ERR_GETVALUE_FILE_NOT_INDICATED ) ;...
Return a config value for a key
10,802
public function setConfigForFilename ( string $ filename , array $ config ) : self { if ( ! isset ( $ this -> configFiles [ $ filename ] ) ) { $ this -> configFiles [ $ filename ] = $ filename ; } $ this -> config [ $ filename ] = $ config ; return $ this ; }
Setter to modify the all config value for a specific filename .
10,803
public function setConfigKeyForFilename ( string $ filename , string $ configKey , $ configValue ) : self { if ( ! isset ( $ this -> config [ $ filename ] ) ) { $ this -> config [ $ filename ] = [ ] ; } if ( ! isset ( $ this -> configFiles [ $ filename ] ) ) { $ this -> configFiles [ $ filename ] = $ filename ; } if ( ...
Setter to modify a config key into the config of a filename
10,804
private function editionVersion ( ) { $ element = JsonListener :: open ( FEnvFcm :: get ( "framework.config.core.config.file" ) ) ; $ date = new \ DateTime ( $ element -> installation -> date ) ; $ date = $ date -> format ( "Y-m-d H:i:s" ) ; $ str = "iumio Framework " . $ element -> edition_fullname . "\nVersion : " . ...
Get the version informations about framework edition
10,805
private function coreVersion ( ) { $ str = "iumio Framework Core named " . FrameworkCore :: CORE_NAME . "\nVersion : " . FrameworkCore :: CORE_VERSION . " build " . FrameworkCore :: CORE_BUILD . "\nStage : " . FrameworkCore :: CORE_STAGE ; Output :: displayAsGreen ( $ str ) ; }
Get the version informations about framework core
10,806
private function selfVersion ( ) { $ element = JsonListener :: open ( FEnvFcm :: get ( "framework.fcm.config.commands.file" ) ) ; $ str = "iumio Framework Console Manager" . "\nVersion : " . $ element -> version . "\nAuthors : " ; foreach ( $ element -> authors as $ one ) { $ str .= $ one -> name . " <" . $ one -> emai...
Get the version informations about fcm
10,807
protected function nameAndParameters ( $ constraint ) { if ( ! strpos ( $ constraint , ':' ) ) { return [ $ this -> normalizeConstraintName ( $ constraint ) , [ ] ] ; } list ( $ name , $ parameters ) = explode ( ':' , $ constraint , 2 ) ; return [ $ this -> normalizeConstraintName ( $ name ) , explode ( ',' , $ paramet...
Split a constraint into its name and an array of parameters
10,808
protected function normalizeNativeRule ( array $ rule ) { $ normalized = [ ] ; foreach ( $ rule as $ key => $ parameters ) { $ normalized [ $ key ] = is_array ( $ parameters ) ? $ parameters : [ $ parameters ] ; } return $ normalized ; }
Make every parameters to array if they are not already arrays .
10,809
public function getTargetFilter ( ) { $ tags = $ this -> ShowTaggedWith -> getValues ( ) ; if ( $ tags && count ( $ tags ) && ! $ this -> data ( ) -> SelfTagPosts ) { return '' ; } return get_class ( $ this -> data ( ) ) . ',' . $ this -> data ( ) -> ID ; }
We only have a target filter _if_ we are not displaying tags or are set to SelfTag posts .
10,810
protected function afterPostCreated ( MicroPost $ post ) { $ tags = array ( ) ; if ( $ this -> data ( ) -> SelfTagPosts ) { $ tags [ ] = $ this -> data ( ) -> selfTag ( ) ; } $ add = $ this -> AddTags -> getValues ( ) ; if ( count ( $ add ) ) { $ tags = array_merge ( $ tags , $ add ) ; } $ post -> tag ( $ tags ) ; }
What tags are present in the request ( ie that should filter and be applied to posts
10,811
public function registerToContainer ( ContainerBuilder $ container , string $ servicePrefix ) : void { $ this -> process ( ) ; $ servicePrefix = rtrim ( $ servicePrefix , '.' ) . '.' ; foreach ( $ this -> sections as $ name => $ config ) { $ container -> setParameter ( $ servicePrefix . $ name . '.is_secure' , $ config...
Register the sections configuration as service - container parameters and a RequestMatcher service .
10,812
protected function lastPosted ( array $ data = null ) : array { $ default_empty_data = [ 'time' => 0 , ] ; $ data = $ this -> s :: sysOption ( 'stats_last_posted' , $ data ) ; $ data = is_array ( $ data ) ? $ data : [ ] ; $ data = array_merge ( $ default_empty_data , $ data ) ; $ data = array_intersect_key ( $ data , $...
Last posted .
10,813
public function freeze ( ) { if ( ! $ this -> frozen ) { $ this -> frozen = true ; foreach ( $ this -> explorableIndex as $ name ) { if ( $ this -> { $ name } instanceof FreezableInterface ) { $ this -> { $ name } -> freeze ( ) ; } } } return $ this ; }
Make all properties read - only unless already frozen .
10,814
protected function buildBindingProxy ( $ originalCallable ) { $ originalCallable = $ this -> checkAndReturnCallable ( $ originalCallable ) ; return function ( $ laravel ) use ( $ originalCallable ) { return call_user_func ( $ originalCallable , $ this ) ; } ; }
If you assign a callable to be called to create the desired binding this container has to be passed to the callable not laravels .
10,815
protected function buildResolvingCallable ( $ originalCallable ) { $ originalCallable = $ this -> checkAndReturnCallable ( $ originalCallable ) ; return function ( $ resolved , $ laravel ) use ( $ originalCallable ) { call_user_func ( $ originalCallable , $ resolved , $ this ) ; } ; }
If you assign a callable to be called when bindings get resolved this container has to be passed to the callable not laravels .
10,816
protected function checkAndReturnCallable ( $ callback ) { if ( is_string ( $ callback ) ) { return function ( $ app ) use ( $ callback ) { return $ app ( $ callback ) ; } ; } if ( ! is_callable ( $ callback ) ) { $ type = is_object ( $ callback ) ? get_class ( $ callback ) : gettype ( $ callback ) ; throw new InvalidA...
Throws an exception if the arg is not callable .
10,817
private function prefixPaths ( array $ paths , string $ prefix ) : array { $ result = [ ] ; foreach ( $ paths as $ namespace => $ path ) { $ result [ $ namespace ] = "{$prefix}/" . trim ( $ path , "/" ) ; } return $ result ; }
Prefixes the given paths automatically with the given prefix
10,818
private function initializeDependencyMap ( array $ config , array $ prefixedNamespaces , ContainerBuilder $ container ) : void { $ registry = new NamespaceRegistry ( $ prefixedNamespaces ) ; $ loader = new DependencyLoader ( $ registry ) ; foreach ( $ config [ "dependency_maps" ] as $ dependencyMap ) { $ loader -> impo...
Initializes the dependency map
10,819
public function render ( ElementInterface $ element ) : string { $ field = $ this -> factory -> create ( $ element -> type ( ) ) -> render ( $ element ) ; $ errors = $ element instanceof ErrorAwareInterface ? $ this -> factory -> create ( Errors :: class ) -> render ( $ element ) : '' ; $ description = $ element instan...
Renders a single FieldRow with label field and errors .
10,820
public function set ( $ name , $ value = null ) { if ( is_array ( $ name ) ) { return $ this -> setValues ( $ name ) ; } $ this -> data [ $ name ] = $ value ; return $ this ; }
Sets a variable to the view data model
10,821
private function setValues ( array $ data ) { foreach ( $ data as $ key => $ datum ) { $ this -> set ( $ key , $ datum ) ; } return $ this ; }
Adds a multiple values from an associative array
10,822
public function editU3iActivity ( ) { $ request = HttpListener :: createFromGlobals ( ) ; $ u3i = ( $ request -> get ( "u3i" ) ) ; $ file = JL :: open ( FEnv :: get ( "framework.config.core.config.file" ) ) ; $ file -> u3i = $ u3i ; JL :: put ( FEnv :: get ( "framework.config.core.config.file" ) , json_encode ( $ file ...
Edit framework U3i
10,823
public function edit200EventActivity ( ) { $ request = HttpListener :: createFromGlobals ( ) ; $ mode = ( $ request -> get ( "mode" ) ) ; $ file = JL :: open ( FEnv :: get ( "framework.config.core.config.file" ) ) ; if ( ! in_array ( $ mode , [ "true" , "false" ] ) ) { return ( ( new Renderer ( ) ) -> jsonRenderer ( ar...
Edit framework 200 event
10,824
public function getDefaultAppActivity ( ) : Renderer { $ default = array ( ) ; $ file = ( array ) JL :: open ( FEnv :: get ( "framework.config.core.apps.file" ) ) ; foreach ( $ file as $ one ) { if ( $ one -> isdefault == "yes" ) { $ default = $ one ; break ; } } return ( ( new Renderer ( ) ) -> jsonRenderer ( array ( ...
Get default App
10,825
public function getFrameworkStatisticsActivity ( ) : Renderer { $ appmaster = $ this -> getMaster ( 'Apps' ) ; $ appstats = $ appmaster -> getStatisticsApp ( ) ; $ routiningmaster = $ this -> getMaster ( 'Routing' ) ; $ routingstats = $ routiningmaster -> getStatisticsRouting ( ) ; $ dbmaster = $ this -> getMaster ( 'D...
Get the framework statistics
10,826
protected function getUnusedPath ( $ path ) { $ newPath = $ path ; $ info = pathinfo ( $ path ) ; $ suffix = 1 ; while ( file_exists ( $ newPath ) ) { $ newPath = $ info [ 'dirname' ] . DIRECTORY_SEPARATOR . "{$info['filename']}_{$suffix}" ; if ( isset ( $ info [ 'extension' ] ) ) { $ newPath .= ".{$info['extension']}"...
Returns an unused file path by adding a filename suffix if necessary .
10,827
public function getChanges ( $ type ) { if ( ! isset ( $ this -> changes [ $ type ] ) ) { return null ; } return $ this -> changes [ $ type ] ; }
Returns all changes for the given type or null if there are no changes .
10,828
public static function hasServerVariable ( string $ name , bool $ ignoreCase = false ) : bool { return ArrayUtils :: doesArrayHaveValueForKey ( self :: $ server , $ name , $ ignoreCase ) ; }
Check if a server variable with the given name exists .
10,829
static function getInputValue ( string $ var , $ from = false , bool $ ignoreCase = false , $ default = null ) { if ( $ from === false ) { foreach ( Request :: INPUT_AVAILABLE_SCOPES as $ scope ) { $ input = self :: getInputValue ( $ var , $ scope , $ ignoreCase ) ; if ( $ input ) { return $ input ; } } } else { $ scop...
Get value of variable passed through HTTP POST GET PUT or DELETE .
10,830
public static function hasInputValue ( string $ var , $ from = false , bool $ ignoreCase = false ) { if ( $ from === false ) { foreach ( Request :: INPUT_AVAILABLE_SCOPES as $ scope ) { $ input = self :: hasInputValue ( $ var , $ scope , $ ignoreCase ) ; if ( $ input ) { return true ; } } return false ; } else { $ scop...
Check if variable passed through HTTP POST GET PUT or DELETE exists .
10,831
public static function hasCookie ( string $ name , bool $ ignoreCase = false ) : bool { return ArrayUtils :: doesArrayHaveValueForKey ( $ _COOKIE , $ name , $ ignoreCase ) ; }
Check if a cookie with the given name exists .
10,832
public static function getPathSegment ( int $ index = 0 ) { $ pathComponents = self :: getPathSegments ( ) ; return ArrayUtils :: getArrayValueForKeyOrDefault ( $ pathComponents , $ index , false ) ; }
Get single path segment from the request - path .
10,833
public static function getPathSegments ( array $ exclude = array ( ) ) : array { $ exclude = array_merge ( $ exclude , array ( INDEX_FILE , CHAR_SPACE , '' ) ) ; $ exclude [ ] = "" ; $ requestUri = self :: getServerVariable ( 'REQUEST_URI' , '' ) ; $ requestUri = substr ( $ requestUri , 0 , ( strpos ( $ requestUri , "?...
Get path segments from the request - path as array .
10,834
public static function getSiteUrl ( ) { if ( ! self :: hasServerVariable ( 'HTTP_HOST' ) ) { return null ; } $ protocol = ( self :: looksLikeHttps ( ) ) ? 'https' : 'http' ; $ port = self :: getServerVariable ( 'SERVER_PORT' , 80 ) ; list ( $ host ) = explode ( ':' , self :: getServerVariable ( 'HTTP_HOST' ) ) ; if ( !...
Getthe base url of the site opened with the current request .
10,835
public static function getLocationUrl ( string $ location ) : string { if ( strpos ( $ location , 'http' ) === 0 ) { return $ location ; } $ locationUrl = self :: getSiteUrl ( ) . $ location ; return preg_replace ( "#([^:])//+#" , "$1/" , $ locationUrl ) ; }
Get the valid fully qualified URL for the specified location .
10,836
public static function getCurrentUrl ( ) : string { $ siteUrl = self :: getSiteUrl ( ) ; $ request = self :: getServerVariable ( 'REQUEST_URI' , self :: getServerVariable ( 'PHP_SELF' , '' ) ) ; $ query = self :: getQueryString ( ) ; $ indexPhpFound = strpos ( $ request , INDEX_FILE ) ; if ( ! USE_INDEX_FILE && ( $ ind...
Get the valid fully qualified URL of the current request . This also includes a check to see if index . php needs to be added or removed from the URL .
10,837
public function bind ( array $ data ) { foreach ( $ data as $ property => $ value ) { if ( $ this -> has ( $ property ) ) { $ this -> $ property = $ value ; } } }
Bind data to the entity .
10,838
public function asArray ( ) { $ fields = [ '@type' => $ this -> type ( ) , '@key' => $ this -> key ( ) , ] ; foreach ( $ this -> fields as $ name => $ field ) { $ fields [ $ name ] = $ field -> value ; } return $ fields ; }
Get the field values
10,839
public function key ( ) { if ( empty ( $ this -> key ) && ! empty ( $ this -> definition -> primary ) ) { $ keys = array_values ( array_filter ( preg_split ( '~[\s,]+~' , $ this -> definition -> primary ) ) ) ; $ keys = array_map ( function ( $ key ) { return Normalise :: toVariable ( $ key ) ; } , $ keys ) ; $ this ->...
Get the field for the primary key .
10,840
public function authenticate ( ) { $ signer = new RequestSigner ( ) ; $ signer -> setProvider ( 'USF' ) ; $ authenticator = new RequestAuthenticator ( $ signer , $ this -> _timeout ) ; $ key = $ authenticator -> authenticate ( $ this -> _requestWrapper , $ this -> _keyLoader ) ; if ( $ key ) { $ this -> principal = "[H...
Validate the HMAC Token
10,841
private static function remoteCredentialProviders ( array $ config = [ ] ) { if ( ! empty ( getenv ( EcsCredentialProvider :: ENV_URI ) ) ) { $ providers [ 'ecs' ] = self :: ecsCredentials ( $ config ) ; } $ providers [ 'instance' ] = self :: instanceProfile ( $ config ) ; if ( isset ( $ config [ 'credentials' ] ) && $...
Remote credential providers returns a list of credentials providers for the remote endpoints such as EC2 or ECS Roles .
10,842
public function getResultType ( ) { return is_object ( $ this -> result ) ? sprintf ( 'object[%s]' , get_class ( $ this -> result ) ) : gettype ( $ this -> result ) ; }
Get result type
10,843
protected function call ( $ url ) { $ scheme = 'https://' ; $ host = 'openapi.bol.com' ; $ content = '' ; $ today = gmdate ( 'D, d F Y H:i:s \G\M\T' ) ; $ contentType = 'application/xml' ; $ headers = array ( 'Content-type: ' . $ contentType , 'Host: ' . $ host , 'Content-length: ' . strlen ( $ content ) , 'X-OpenAPI-A...
Prepare headers compose url and make a call
10,844
protected function getXmlElement ( $ response ) { try { $ xmlElement = new \ SimpleXMLElement ( $ response -> getContent ( ) ) ; } catch ( \ Exception $ e ) { throw new BolException ( 'Error parsing the xml as SimpleXMLElement' , null , $ e ) ; } if ( $ response -> getStatusCode ( ) !== 200 ) { throw new BolException (...
Convert response into SimpleXmlElement and throw an exception if parsing is impossible Also throws an exception if response status code is not 200
10,845
protected function getSignature ( $ date , $ httpMethod , $ url , $ contentType ) { $ parsedUrl = parse_url ( $ url ) ; $ signature = $ httpMethod . "\n\n" ; $ signature .= $ contentType . "\n" ; $ signature .= $ date . "\n" ; $ signature .= "x-openapi-date:" . $ date . "\n" ; if ( ! is_null ( $ this -> sessionId ) ) {...
Format a signature for the X - OpenAPI - Authorization header
10,846
public function actionAllChanged ( ) { Output :: line ( 'Getting package info...' ) ; $ collection = \ App :: $ domain -> vendor -> info -> allChanged ( ) ; if ( ! empty ( $ collection ) ) { $ names = ArrayHelper :: getColumn ( $ collection , 'alias' ) ; Output :: line ( ) ; Output :: arr ( $ names , 'Changed repositor...
Changed package list
10,847
public function actionAllVersion ( ) { Output :: line ( 'Getting package info...' ) ; $ collection = \ App :: $ domain -> vendor -> info -> allVersion ( ) ; if ( ! empty ( $ collection ) ) { $ flatCollection = ArrayHelper :: map ( $ collection , 'package' , 'version' ) ; Output :: line ( ) ; Output :: arr ( $ flatColle...
Package list with version
10,848
public function actionAllVersionExtensions ( ) { Output :: line ( ) ; $ result = ArrayHelper :: map ( Yii :: $ app -> extensions , 'name' , 'version' ) ; Output :: arr ( $ result , 'Repository version list' ) ; }
Package list with version for all
10,849
public function actionAllForRelease ( ) { Output :: line ( 'Getting package info...' ) ; $ collection = \ App :: $ domain -> vendor -> info -> allForRelease ( ) ; if ( ! empty ( $ collection ) ) { $ flatCollection = ArrayHelper :: map ( $ collection , 'package' , 'version' ) ; Output :: line ( ) ; Output :: arr ( $ fla...
Package list for release
10,850
public function actionPackageUses ( ) { list ( $ owner , $ name ) = $ this -> inputPackage ( ) ; Output :: line ( 'Find uses in package...' ) ; $ requiredCollection = \ App :: $ domain -> vendor -> info -> usesById ( $ owner . '-yii2-' . $ name ) ; Output :: line ( ) ; foreach ( $ requiredCollection as $ requiredEntity...
Get package dependencies
10,851
public function noticeErrors ( string $ heading , array $ error_messages ) : string { if ( ! $ error_messages ) { return '' ; } $ markup = '' ; $ heading = $ heading && mb_strpos ( $ heading , '</i>' ) === false ? '<i class="sharkicon sharkicon-enty-exclamation"></i> ' . $ heading : $ heading ; $ error_messages = $ thi...
Notice errors .
10,852
public function getAttribute ( $ key ) { $ value = parent :: getAttribute ( $ key ) ; foreach ( static :: $ getter_manipulators as $ manipulator ) { $ value = $ manipulator ( $ this , $ key , $ value ) ; } return $ value ; }
Gets an attribute value after running through the manipulators .
10,853
public function setAttribute ( $ key , $ value ) { foreach ( static :: $ setter_manipulators as $ manipulator ) { $ value = $ manipulator ( $ this , $ key , $ value ) ; } parent :: setAttribute ( $ key , $ value ) ; }
Sets an attribute value after running through the manipulators .
10,854
public function paginate ( $ page = 1 , $ perPage = 15 ) { $ cacheKey = "$page|$perPage" ; if ( isset ( $ this -> _paginationCache [ $ cacheKey ] ) ) { return $ this -> _paginationCache [ $ cacheKey ] ; } $ this -> parseInputOnce ( ) ; $ this -> _paginationCache [ $ cacheKey ] = $ this -> createPaginator ( $ this -> fi...
Paginate the result . Return whatever paginator you use . The paginator should be \ Traversable .
10,855
final public static function enableSmartyDebug ( bool $ status ) { $ sconfig = new SmartyConfig ( FEnv :: get ( "framework.env" ) ) ; FEnv :: set ( "framework.smarty.debug" , $ sconfig -> getSmartyDebug ( ) ) ; }
Enable smarty debug tool
10,856
final private function registerExtendedPlugin ( ) { if ( self :: $ appCall != null ) { if ( Server :: exist ( FEnv :: get ( "framework.apps" ) . FEnv :: get ( "app.call" ) . "/Extra/" . strtolower ( FEnv :: get ( "app.call" ) ) . ".view.plugin.json" ) ) { $ file = JsonListener :: open ( FEnv :: get ( "framework.apps" )...
Register an new plugin for smarty template
10,857
public static function getSmartyInstance ( string $ appFullName = null ) : \ Smarty { if ( self :: $ instance == null ) { if ( self :: $ appCall != $ appFullName ) { self :: $ appCall = $ appFullName ; ; new SmartyEngineTemplate ( ) ; } } return ( self :: $ instance ) ; }
Return an instance of SmartyEngineTemplate
10,858
private function getMaxMTime ( $ theDirName ) { $ iterator = new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ theDirName , FilesystemIterator :: SKIP_DOTS ) , RecursiveIteratorIterator :: SELF_FIRST ) ; $ mtime = null ; foreach ( $ iterator as $ file_info ) { $ mtime = max ( $ mtime , $ file_info -> g...
Get max mtime from all files in directory .
10,859
public function confirmAction ( $ token ) { $ user = $ this -> container -> get ( 'fos_user.user_manager' ) -> findUserByConfirmationToken ( $ token ) ; if ( null === $ user ) { throw new NotFoundHttpException ( sprintf ( 'The user with confirmation token "%s" does not exist' , $ token ) ) ; } $ form = $ this -> contai...
Receive the confirmation token from user email provider login the user
10,860
protected function setGetter ( callable $ getter ) { $ this -> getter = $ getter ; if ( is_array ( $ getter ) && is_object ( $ getter [ 0 ] ) ) { $ this -> _creator = $ getter [ 0 ] ; } return $ this ; }
Set the getter to retrieve the results .
10,861
protected function initializeBundleSelectionPrice ( array $ attr ) { $ storeViewCode = $ this -> getStoreViewCode ( StoreViewCodes :: ADMIN ) ; $ store = $ this -> getStoreByStoreCode ( $ storeViewCode ) ; $ websiteId = $ store [ MemberNames :: WEBSITE_ID ] ; $ parentProductId = $ this -> mapSku ( $ this -> getValue ( ...
Initialize the bundle selection price with the passed attributes and returns an instance .
10,862
public function getLanguage ( ) { foreach ( $ this -> languageDetectionServices as $ languageDetectionService ) { $ language = $ languageDetectionService -> getLanguage ( ) ; if ( $ language === null || empty ( $ language ) ) { continue ; } else { return $ language ; } } return ; }
Returns the language to use considering all the LanguageDetection services configured . If no language found this return null
10,863
public function getCurrentEnv ( ) : string { $ f = new JsonListener ( ) ; $ result = $ f -> open ( realpath ( __DIR__ . "/../../../../../../../elements/config_files/core/framework.config.json" ) ) ; return ( $ result -> default_env ) ; }
Get the default environment
10,864
private function extractStability ( $ version ) { $ stability = $ this -> getExplicitStability ( $ version ) ; if ( $ stability === null ) { $ stability = $ this -> getParsedStability ( $ version ) ; } return $ stability ; }
Extract stability .
10,865
private function getParsedStability ( $ version ) { $ version = preg_replace ( '/^([^,\s@]+) as .+$/' , '$1' , $ version ) ; $ stability = $ this -> getStabilityInteger ( VersionParser :: parseStability ( $ version ) ) ; if ( $ stability === BasePackage :: STABILITY_STABLE || $ this -> minimumStability > $ stability ) ...
Get the stability of a version
10,866
protected static function splitConstraints ( $ version ) { $ found = [ ] ; $ pattern = '/(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)/' ; foreach ( preg_split ( '/\s*\|\|?\s*/' , trim ( $ version ) ) as $ constraints ) { $ andConstraints = preg_split ( $ pattern , $ constraints ) ; foreach ( $ andConstraints as $ con...
Split a version specification into a list of version constraints .
10,867
public function run ( string $ path ) { $ dir = opendir ( $ path ) ; if ( $ dir === false ) { throw new Exception ( 'The directory can not be open. ' . 'See php error log for more informations.' , self :: ERR_RUN_OPENDIR ) ; } while ( ( $ file = readdir ( $ dir ) ) !== false ) { $ action = $ this -> itemAction ( $ file...
Read all the directories
10,868
protected function dirAction ( string $ dirPath ) { $ read = new $ this -> calledClass ( $ this -> list ) ; $ read -> run ( $ dirPath ) ; }
Recall ReadDirectory to read this directory This is to avoid having the recursion error
10,869
public function getCallbackAsString ( ) { if ( is_string ( $ this -> callback ) ) { return $ this -> callback ; } if ( is_array ( $ this -> callback ) && count ( $ this -> callback ) == 2 ) { list ( $ object , $ method ) = array_values ( $ this -> callback ) ; is_object ( $ object ) ? sprintf ( 'object[%s]#%s' , get_cl...
Get string representation of callback
10,870
public static function startFreeTrial ( Companies $ company ) : Suscriptions { $ subscription = new self ( ) ; $ subscription -> plans_id = self :: FREE_TRIAL ; $ subscription -> users_id = $ company -> users_id ; $ subscription -> apps_id = self :: DEFAULT_APP ; $ subscription -> stripe_id = '' ; $ subscription -> com...
Start a free trial to the system
10,871
final protected function get ( string $ component ) { switch ( $ component ) { case 'request' : return ( FrameworkCore :: getRuntimeParameters ( ) ) -> request ; break ; case 'query' : return ( FrameworkCore :: getRuntimeParameters ( ) ) -> query ; break ; case 'session' : return ( HttpSession :: getInstance ( ) ) ; br...
Get a component
10,872
final protected function render ( string $ view , array $ options = array ( ) , bool $ iscached = true ) : Renderer { $ r = new Renderer ( ) ; return ( $ r -> graphicRenderer ( $ view , $ options , $ iscached ) ) ; }
Show a view
10,873
final public function registerViewPlugin ( string $ type , string $ name , array $ method ) : int { $ si = SmartyEngineTemplate :: getSmartyInstance ( $ this -> appMastering ) ; if ( $ type !== "modifier" && $ type != "function" ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Undefined plugin type $...
Register a new view plugin This plugin allow to use in your smarty view
10,874
final public function generateRoute ( string $ routename , array $ parameters = null , string $ app_called = null , bool $ component = false ) : string { return ( Routing :: generateRoute ( $ routename , $ parameters , $ app_called , $ component ) ) ; }
Generate route url
10,875
final protected function getMaster ( string $ mastername ) { if ( FEnv :: get ( "app.is_components" ) == 1 ) { $ file = JL :: open ( FEnv :: get ( "framework.baseapps.apps.file" ) ) ; } else { $ file = JL :: open ( FEnv :: get ( "framework.config.core.apps.file" ) ) ; } $ app = null ; foreach ( $ file as $ one => $ val...
Return instance of specific master in current app
10,876
public function total ( array $ args = [ ] ) : int { $ default_args = [ 'filters' => [ ] , 'include' => [ ] , 'exclude' => [ ] , 'no_cache' => false , ] ; $ args = array_merge ( $ default_args , $ args ) ; $ args = array_intersect_key ( $ args , $ default_args ) ; $ args [ 'filters' ] = ( array ) $ args [ 'filters' ] ;...
Total post types .
10,877
public final static function decode ( string $ source ) : array { if ( is_null ( $ source = json_decode ( $ source , true ) ) && json_last_error ( ) !== JSON_ERROR_NONE ) { throw new \ Exception ( 'Invalid json format!' ) ; } return $ source ; }
Decodes a JSON string into an associative array .
10,878
public final static function encode ( array $ source ) : string { if ( ( $ source = json_encode ( $ source ) ) == false && json_last_error ( ) !== JSON_ERROR_NONE ) { throw new \ Exception ( 'Invalid raw data!' ) ; } return $ source ; }
Encodes an associative array into its JSON string representation .
10,879
public final static function append ( string $ source , array $ Append ) : string { return self :: encode ( Arr :: append ( self :: decode ( $ source ) , $ Append ) ) ; }
Adds the given data into the end of the given JSON string representation .
10,880
public final static function prepend ( string $ source , array $ Prepend ) : string { return self :: encode ( Arr :: prepend ( self :: decode ( $ source ) , $ Prepend ) ) ; }
Adds the given data into the beginning of the given JSON string representation .
10,881
public final static function clear ( string $ source , $ keys ) : string { return self :: encode ( Arr :: clear ( self :: decode ( $ source ) , ... array_slice ( func_get_args ( ) , 1 ) ) ) ; }
Removes an element from the given JSON string representation .
10,882
public final static function improve ( string $ source , $ keys , $ value ) : string { return self :: encode ( Arr :: improve ( self :: decode ( $ source ) , ... array_slice ( func_get_args ( ) , 1 ) ) ) ; }
Adds an element into the given JSON string representation .
10,883
public final static function merge ( string $ source , array $ Values ) { return self :: encode ( array_merge ( self :: decode ( $ source ) , $ Values ) ) ; }
Merge an array with the given JSON string representation .
10,884
public final static function get ( string $ source , $ key , $ default = null ) { return Arr :: get ( self :: decode ( $ source ) , $ key , $ default ) ; }
Returns a single element from a JSON array by its key .
10,885
public static function open ( string $ filepath ) : \ stdClass { if ( $ filepath == self :: $ filepath && self :: $ file != null ) { return ( self :: $ file ) ; } if ( ! file_exists ( $ filepath ) ) { throw new Server500 ( new \ ArrayObject ( array ( "explain" => "Cannot open file $filepath : File does not exist" , "so...
Open file configuration
10,886
public static function exists ( string ... $ filepath ) { if ( count ( $ filepath ) == 1 ) { return ( file_exists ( $ filepath [ 0 ] ) ) ; } else { $ exists = [ ] ; foreach ( $ filepath as $ one ) { array_push ( $ exists , [ $ one => file_exists ( $ one ) ] ) ; } return ( $ exists ) ; } }
Check if json file exist
10,887
public function fillCache ( ? SymfonyStyle $ io ) { $ progressBar = null ; if ( null !== $ io ) { $ io -> section ( "Cache Warm up" ) ; } if ( $ this -> isDebug ) { if ( null !== $ io ) { $ io -> comment ( "Skipping, as the assets are not dumped in debug mode." ) ; } return ; } if ( null !== $ io ) { $ io -> text ( "Se...
Warms up the cache
10,888
protected function writeToBigStorageIfNeeded ( $ id , & $ value ) { if ( ! $ this -> bigStorage ) { return false ; } if ( is_string ( $ value ) && strlen ( $ value ) <= $ this -> maxMainStorageBytes ) { return false ; } try { $ this -> bigStorage [ $ id ] = $ value ; return true ; } catch ( \ Exception $ e ) { $ msg = ...
Writes to big storage if that is possible .
10,889
protected function castLoadedEntry ( array $ entry ) { $ entry [ 'valid_until' ] = ( int ) $ entry [ 'valid_until' ] ; $ entry [ 'outside' ] = ( int ) $ entry [ 'outside' ] ; $ entry [ 'plain' ] = ( int ) $ entry [ 'plain' ] ; if ( ( bool ) $ entry [ 'outside' ] ) { return $ entry ; } if ( ! ( bool ) $ entry [ 'plain' ...
Cast the values of an loaded entry .
10,890
private function css ( $ file , $ path = 'css' , array $ options = [ ] ) { $ attr = array_key_exists ( 'attr' , $ options ) ? $ options [ 'attr' ] : [ ] ; $ attr = array_merge ( [ 'rel' => 'stylesheet' ] , $ attr ) ; $ location = $ this -> location ( "{$path}/{$file}" , $ options ) ; return sprintf ( '<link href="%s" %...
Creates a css link tag for provided css file
10,891
public function actionView ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ query = $ model -> getAnswers ( ) -> with ( 'user' ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , ] ) ; return $ this -> render ( 'view' , [ 'model' => $ model , 'dataProvider' => $ dataProvider ] ) ; }
Displays a single Question model .
10,892
public function benchmark ( $ iterations = 10000 , $ inputSize = null ) { $ set = new BenchmarkResultsSet ( $ iterations , $ inputSize ) ; $ this -> resultsGroup -> addSet ( $ set ) ; foreach ( $ this -> getSamplersForInputSize ( $ inputSize ) as $ name => $ func ) { $ actualIterations = $ this -> getActualIterations (...
Perform a set of benchmarks .
10,893
public function progression ( $ startIterations , $ startSize , $ numOfBenchmarks = 4 , $ base = 2 ) { $ factor = 1 ; for ( $ i = 1 ; $ i <= $ numOfBenchmarks ; $ i ++ ) { $ this -> benchmark ( ( int ) ( $ startIterations / $ factor ) , $ startSize * $ factor ) ; $ factor *= $ base ; } }
The aim of this function is to perform a multiple set of benchmarks with different iterations and input sizes but trying to keep the same execution time for each set .
10,894
protected function getAttributeFilter ( ) { if ( $ this -> attributeFilter ) { return $ this -> attributeFilter ; } return function ( $ key , $ value ) { if ( in_array ( $ key , $ this -> getNonScalarAttributes ( ) ) ) { return ! is_scalar ( $ value ) ; } if ( ends_with ( $ key , '_id' ) && trim ( $ value ) === '' ) { ...
Return the internal attribute filter . If none is present create one .
10,895
protected function loadNonScalarAttributes ( ) { $ nonScalar = [ ] ; foreach ( Cheat :: get ( $ this -> model , 'casts' ) as $ key => $ cast ) { if ( in_array ( $ cast , [ 'array' , 'json' , 'object' , 'collection' ] , true ) ) { $ nonScalar [ ] = $ key ; } } return $ nonScalar ; }
Loads jsonable attributes so they get not filtered while saving attributes .
10,896
public function actionDelete ( $ id ) { if ( Yii :: $ app -> request -> isPost ) { $ this -> findModel ( $ id ) -> delete ( ) ; } return $ this -> redirect ( [ 'index' ] ) ; }
Deletes an existing Setting . If deletion is successful the browser will be redirected to the index page .
10,897
protected function setTable ( $ table ) { $ this -> table = $ table ; $ this -> quotedTable = $ this -> dialect -> quote ( $ table , 'name' ) ; return $ this ; }
Set the table for the queries .
10,898
protected function setIdKey ( $ idKey ) { $ this -> idKey = $ idKey ; $ this -> quotedIdKey = $ this -> dialect -> quote ( $ idKey , 'name' ) ; return $ this ; }
Set the name of the id column .
10,899
public function offsetExists ( $ key ) { if ( parent :: offsetExists ( $ key ) ) { return true ; } if ( isset ( $ this -> _originalAttributes [ $ key ] ) ) { return false ; } if ( ! $ data = $ this -> getFromDB ( $ key ) ) { return false ; } $ this -> _originalAttributes [ $ key ] = $ data ; $ this -> _attributes [ $ k...
Loads the entry from db if not previously done .