idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
232,700
protected function getListAlias ( ) { $ id = $ this -> getParam ( 0 ) ; if ( ! isset ( $ id ) ) { return $ this -> alias -> getList ( array ( 'limit' => $ this -> getLimit ( ) ) ) ; } if ( $ this -> getParam ( 'entity' ) ) { return $ this -> alias -> getList ( array ( 'entity' => $ id , 'limit' => $ this -> getLimit ( ...
Returns an array of URL aliases
232,701
public function render ( ) { if ( ! $ this -> view ) { return false ; } return $ this -> renderRawData ( $ this -> data ? : $ this -> renderFile ( $ this -> getViewFile ( $ this -> view ) , $ this -> params ) ) ; }
Render insert data into view
232,702
public function renderRawData ( $ data = '' ) { $ layoutPath = null ; if ( $ this -> layout && ( ! $ layoutPath = $ this -> getLayoutFile ( ( new KernelInjector ) -> build ( ) -> getAppDir ( ) , $ this -> module ) ) ) { ( new LoggerInjector ) -> build ( ) -> send ( 'error' , 'Layout `' . $ this -> layout . '` not found...
Render raw data in layout
232,703
protected function getLayoutFile ( $ appDir , $ module ) { if ( $ module ) { $ module = strtolower ( str_replace ( '\\' , '/' , $ module ) ) ; $ module = substr ( $ module , strpos ( $ module , '/' ) + 1 ) ; $ module = substr ( $ module , 0 , strrpos ( $ module , '/' ) ) ; } $ layout = $ appDir . '/' . ( $ module ? $ m...
Get layout path
232,704
protected function renderFile ( $ fileName , array $ data = [ ] ) { $ lang = new Language ( $ fileName ) ; extract ( $ data , EXTR_PREFIX_SAME || EXTR_REFS , 'data' ) ; ob_start ( ) ; include str_replace ( '\\' , '/' , $ fileName ) ; if ( ! empty ( $ GLOBALS [ 'widgetStack' ] ) ) { throw new Exception ( count ( $ GLOBA...
Render file by path
232,705
private function getViewFile ( $ view ) { $ calledClass = $ this -> path ; if ( 0 === strpos ( $ calledClass , 'App' ) ) { $ path = ( new KernelInjector ) -> build ( ) -> getAppDir ( ) ; } else { $ path = Autoload :: getAlias ( 'Micro' ) ; } $ cl = strtolower ( dirname ( str_replace ( '\\' , '/' , $ calledClass ) ) ) ;...
Get view file
232,706
final public static function checkPhpVersion ( ) { $ phpv = phpversion ( ) ; if ( $ phpv >= self :: $ php_accept ) { return ( json_encode ( array ( "code" => 200 , "results" => "OK" , "phpv" => $ phpv ) ) ) ; } else { return ( json_encode ( array ( "code" => 500 , "results" => "NOK" , "phpv" => $ phpv , "msg" => "The v...
Check the php version
232,707
final public static function checkFrameworkBuildVersion ( ) { $ f = json_decode ( file_get_contents ( __DIR__ . "/../../elements/config_files/core/framework.config.json" ) ) ; if ( ! property_exists ( $ f , 'installation' ) ) { return ( json_encode ( array ( "code" => 500 , "results" => "NOK" , "fv" => "unknow" , "msg"...
Check the iumio Framework version
232,708
final public static function isDirEmpty ( $ dir ) { if ( ! is_readable ( $ dir ) ) { return ( null ) ; } $ handle = opendir ( $ dir ) ; while ( false !== ( $ entry = readdir ( $ handle ) ) ) { if ( $ entry != "." && $ entry != ".." ) { return ( false ) ; } } return ( true ) ; }
Check if dir is empty or not
232,709
final public static function checkLibrariesRequired ( ) { $ base = __DIR__ . "/../../" ; foreach ( self :: $ libs as $ lib => $ val ) { if ( ! is_dir ( $ base . $ lib ) || ! self :: checkIsReadable ( $ base . $ lib ) || ! self :: checkIsWritable ( $ base . $ lib ) || self :: isDirEmpty ( $ base . $ lib ) ) { return ( j...
Check if librairies required are installed
232,710
public function setParameters ( array $ params ) : self { foreach ( $ params as $ key => $ value ) { $ this -> parameters [ $ key ] = $ value ; } return $ this ; }
Adds new parameters . The %params% will be expanded .
232,711
public function setDebugMode ( $ value ) : self { if ( is_string ( $ value ) || is_array ( $ value ) ) { $ value = static :: detectDebugMode ( $ value ) ; } elseif ( ! is_bool ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( 'Value must be either a string, array, or boolean, %s given.' , gettype ( $ value...
Set parameter %debugMode% .
232,712
public function createContainer ( ) : Factory { Core :: $ appDir = $ this -> parameters [ 'appDir' ] ; Core :: $ wwwDir = $ this -> parameters [ 'wwwDir' ] ; Core :: $ tempDir = $ this -> parameters [ 'tempDir' ] ; Core :: $ logDir = $ this -> parameters [ 'logDir' ] ; if ( $ this -> parameters [ 'debugMode' ] ) { defi...
Create the container which holds FuzeWorks .
232,713
public function get ( string $ configKey , string $ configFile = 'default' , ? string $ parseType = null ) { $ this -> load ( $ configFile ) ; if ( ! isset ( $ this -> data [ $ configFile ] ) ) { return false ; } if ( ! isset ( $ this -> data [ $ configFile ] [ $ configKey ] ) ) { return false ; } $ response = $ this -...
Get config value by config key from configuration file
232,714
public function getAll ( $ configFile = 'default' ) : ? array { $ this -> load ( $ configFile ) ; if ( ! Any :: isArray ( $ this -> data ) || ! array_key_exists ( $ configFile , $ this -> data ) ) { return null ; } return $ this -> data [ $ configFile ] ; }
Get all configuration data of selected file
232,715
public function updateConfig ( string $ configFile , array $ newData , ? bool $ mergeDeep = false ) : bool { $ this -> load ( $ configFile ) ; if ( ! isset ( $ this -> data [ $ configFile ] ) ) { return false ; } $ oldData = $ this -> data [ $ configFile ] ; $ saveData = ( $ mergeDeep ? Arr :: mergeRecursive ( $ oldDat...
Update configuration data based on key - value array of new data . Do not pass multi - level array on new position without existing keys
232,716
public function writeConfig ( string $ configFile , array $ data ) : bool { $ path = '/Private/Config/' . ucfirst ( Str :: lowerCase ( $ configFile ) ) . '.php' ; if ( ! File :: exist ( $ path ) || ! File :: writable ( $ path ) ) { return false ; } $ saveData = '<?php return ' . Arr :: exportVar ( $ data ) . ';' ; File...
Write configurations data from array to cfg file
232,717
protected function renderContent ( array $ replacements ) { return $ this -> getContentReplacer ( ) -> replace ( $ this -> content , array_merge ( [ 'app_name' => config ( 'app.name' ) , 'app_url' => link_to ( config ( 'app.url' ) , config ( 'app.name' ) ) , 'mobile' => html ( ) -> tel ( config ( 'cms.company.mobile' )...
Render the content .
232,718
public function setLabel ( LabelElement $ label ) { $ this -> label = $ label ; if ( ( $ for = $ this -> getAttribute ( 'id' ) ) ) { $ label -> setAttribute ( 'for' , $ for ) ; } return $ this ; }
assign label element to this form element for attribute of label is set if form element has an id attribute
232,719
public function setAttribute ( $ attr , $ value ) { $ attr = strtolower ( $ attr ) ; if ( $ attr === 'value' ) { return $ this -> setValue ( $ value ) ; } if ( $ attr === 'name' ) { return $ this -> setName ( $ value ) ; } if ( $ attr === 'id' && $ this -> label ) { $ this -> label -> setAttribute ( 'for' , $ value ) ;...
sets miscellaneous attribute of form element attributes value name are treated by calling the according setters setting id will update for when a label element is assigned
232,720
public function setAttributes ( Array $ attributes ) { foreach ( $ attributes as $ k => $ v ) { $ this -> setAttribute ( $ k , $ v ) ; } return $ this ; }
sets several attributes with an associative array
232,721
public function getAttribute ( $ name ) { $ key = strtolower ( $ name ) ; if ( 'value' === $ key ) { return $ this -> getValue ( ) ; } if ( 'name' === $ key ) { return $ this -> getName ( ) ; } if ( array_key_exists ( $ key , $ this -> attributes ) ) { return $ this -> attributes [ strtolower ( $ name ) ] ; } return nu...
get a single attribute name and value attributes are redirected to the respective getter methods
232,722
public function isValid ( ) { if ( ! isset ( $ this -> valid ) ) { $ this -> valid = $ this -> applyValidators ( $ this -> applyModifiers ( $ this -> getValue ( ) ) ) ; } return $ this -> valid ; }
checks whether modified form element passes validation rules
232,723
public function canSubmit ( ) { return $ this instanceof InputElement && isset ( $ this -> attributes [ 'type' ] ) && $ this -> attributes [ 'type' ] == 'submit' || $ this instanceof ImageElement || $ this instanceof SubmitInputElement || $ this instanceof ButtonElement && $ this -> attributes [ 'type' ] == 'submit' ; ...
check whether element can submit a form
232,724
public function render ( ) { if ( ! $ this -> template ) { throw new \ RuntimeException ( sprintf ( "No template for element '%s' defined." , $ this -> getName ( ) ) ) ; } $ this -> html = $ this -> template -> assign ( 'element' , $ this ) -> display ( ) ; return $ this -> html ; }
renders form element and returns markup requires a template for rendering
232,725
public function prepare ( $ connectionId , Credentials $ credentials ) { $ connection = Connection :: fromCredentials ( $ credentials ) ; $ this -> store ( $ connectionId , $ connection ) ; }
Stores a new database connection with provided credentials .
232,726
public function store ( $ connectionId , Connection $ connection ) { $ connectionId = ( string ) $ connectionId ; $ this -> connections [ $ connectionId ] = $ connection ; }
Stores an existing database connection .
232,727
public function fetch ( $ connectionId ) { $ connectionId = ( string ) $ connectionId ; if ( $ this -> exist ( $ connectionId ) ) { return $ this -> connections [ $ connectionId ] ; } throw new \ DomainException ( "Requested database connection '{$connectionId}' does not exist." ) ; }
Returns the database connection with provided identifier or throws an exception if not found .
232,728
public function actionMinute ( ) { $ this -> stdout ( "Executing minute tasks:" . PHP_EOL , Console :: FG_YELLOW ) ; $ this -> trigger ( self :: EVENT_ON_MINUTE_RUN ) ; Yii :: $ app -> settings -> set ( 'cronLastMinuteRun' , time ( ) , 'core' ) ; return ExitCode :: OK ; }
Executes minute cron tasks .
232,729
public function actionHourly ( ) { $ this -> stdout ( "Executing hourly tasks:" . PHP_EOL , Console :: FG_YELLOW ) ; $ this -> trigger ( self :: EVENT_ON_HOURLY_RUN ) ; Yii :: $ app -> settings -> set ( 'cronLastHourlyRun' , time ( ) , 'core' ) ; return ExitCode :: OK ; }
Executes hourly cron tasks .
232,730
public function actionDaily ( ) { $ this -> stdout ( "Executing daily tasks:" . PHP_EOL , Console :: FG_YELLOW ) ; $ this -> trigger ( self :: EVENT_ON_DAILY_RUN ) ; Yii :: $ app -> settings -> set ( 'cronLastDailyRun' , time ( ) , 'core' ) ; return ExitCode :: OK ; }
Executes daily cron tasks .
232,731
public function actionMonth ( ) { $ this -> stdout ( "Executing month tasks:" . PHP_EOL , Console :: FG_YELLOW ) ; $ this -> trigger ( self :: EVENT_ON_MONTH_RUN ) ; Yii :: $ app -> settings -> set ( 'cronLastMonthRun' , time ( ) , 'core' ) ; return ExitCode :: OK ; }
Executes month cron tasks .
232,732
public function getImageResizeDefinitionByWidth ( $ width ) { if ( ! key_exists ( $ width , $ this -> irds ) ) { throw new WidthNotAllowedException ( $ width ) ; } return $ this -> irds [ $ width ] ; }
Get an ImageResizeDefinition for a given width
232,733
public function setScaleAlgorithm ( $ algorithm ) { foreach ( $ this -> available_image_widths as $ width ) { $ this -> irds [ $ width ] -> setScaleAlgorithm ( $ algorithm ) ; } return $ this ; }
Set the algorithm used for scaling
232,734
public function getTotalDays ( ) { $ dt = new \ DateTimeImmutable ( ) ; return $ dt -> add ( $ this -> Value ) -> diff ( $ dt ) -> days ; }
Return the total days of the duration
232,735
public static function hasValue ( $ di ) { $ components = array ( "s" , "i" , "h" , "d" , "m" , "y" ) ; $ hasValue = false ; foreach ( $ components as $ component ) { $ hasValue = isset ( $ di -> $ component ) && $ di -> $ component != 0 ; if ( $ hasValue ) break ; } return $ hasValue ; }
Returns true if the date interval parameter has a non zero value
232,736
public function compile ( ExpressCompiler $ compiler , $ flags = 0 ) { try { if ( $ flags & self :: FLAG_RAW ) { if ( empty ( $ this -> childNodes ) ) { $ compiler -> write ( "''" ) ; } else { $ compiler -> write ( '(' ) ; foreach ( $ this -> childNodes as $ i => $ node ) { if ( $ i > 0 ) { $ compiler -> write ( ' . ' ...
Compile the attribute value into it s PHP code .
232,737
public function loadClassMetadata ( LoadClassMetadataEventArgs $ args ) { if ( empty ( $ this -> prefix ) ) { return ; } $ classMetadata = $ args -> getClassMetadata ( ) ; if ( false === strpos ( $ classMetadata -> getTableName ( ) , $ this -> prefix ) ) { $ tableName = $ this -> prefix . $ classMetadata -> getTableNam...
Load class meta data event
232,738
public function init ( ) { parent :: init ( ) ; Yii :: setAlias ( 'foxslider' , dirname ( dirname ( dirname ( __DIR__ ) ) ) ) ; $ this -> registerComponents ( ) ; }
Initialize the services .
232,739
private function checkInputs ( $ short , $ long ) { $ key = array_search ( $ short , $ this -> inputs ) ; if ( $ key === false ) { $ key = array_search ( $ long , $ this -> inputs ) ; if ( $ key === false ) { return false ; } else { return $ key ; } } else { return $ key ; } }
Check input for flag
232,740
private function checkRequired ( ) { foreach ( $ this -> params as $ param ) { if ( array_key_exists ( 'required' , $ param ) && $ param [ 'required' ] == true ) { if ( ! array_key_exists ( $ param [ 'name' ] , $ this -> pinputs ) ) { throw new \ Exception ( 'Parameter "' . $ param [ 'name' ] . '" is required' ) ; } } ...
Check required options If a required option is not provided then throw and exception
232,741
public static function confirm ( $ msg ) { echo $ msg ; $ input = trim ( fgets ( STDIN ) ) ; if ( strtolower ( $ input ) == 'y' || strtolower ( $ input ) == 'yes' ) { return true ; } else { return false ; } }
Add a confirmation
232,742
public function outputHelp ( $ short = false ) { echo "Usage: " . $ this -> getName ( ) . " " ; if ( ! empty ( $ this -> params ) ) { foreach ( $ this -> params as $ param ) { if ( $ param [ 'required' ] == true ) { echo '<' . $ param [ 'name' ] . '> ' ; } else { echo '[' . $ param [ 'name' ] . '] ' ; } } } echo "[opti...
Output help text
232,743
private function writeLine ( string $ str ) { $ now = time ( ) ; if ( $ this -> file && $ this -> file_opened < $ now - $ this -> reopen_interval ) { fclose ( $ this -> file ) ; $ this -> file = null ; } if ( ! $ this -> file ) { touch ( $ this -> filename ) ; try { Hook :: execute ( "Wedeto.IO.FileCreated" , [ 'path' ...
Write a line to the log file
232,744
public function insertOrUpdate ( $ tableORq , $ data ) { if ( is_string ( $ tableORq ) ) { $ this -> defaults [ 'table' ] = $ tableORq ; $ tableORq = [ ] ; } extract ( $ this -> defaults ) ; extract ( $ tableORq ) ; if ( ! $ table ) throw new Exception ( "table [$tabel] not defined" , 1 ) ; $ sql = 'INSERT OR REPLACE I...
inserts or update a record
232,745
protected function Init ( ) { $ htmlCode = ContentHtmlCode :: Schema ( ) -> ByContent ( $ this -> content ) ; $ this -> code = $ htmlCode -> GetCode ( ) ; return parent :: Init ( ) ; }
Initializes the html code frontend module
232,746
public function BackendName ( ) { $ result = 'code' ; if ( ! $ this -> content ) { return $ result ; } $ htmlCode = ContentHtmlCode :: Schema ( ) -> ByContent ( $ this -> content ) ; $ code = Text :: Shorten ( $ htmlCode -> GetCode ( ) ) ; if ( $ code ) { $ result .= ' - ' . $ code ; } return $ result ; }
The backend name for the code
232,747
public function pass ( ) { $ action = $ this -> getParameter ( 'action' ) ; return $ this -> Permissions -> checkPermission ( $ action , $ this -> getLocal ( 'SiteSlug' ) ) ; }
Checks if the specified action is granted to the current user
232,748
public function required ( $ input , $ key , $ lang ) { $ lang = $ this -> custom ( 'required' , $ lang ) ; if ( empty ( $ input [ $ key ] ) ) { return str_replace ( ':field' , $ key , $ lang ) ; } }
Parses a required validation field .
232,749
public function match ( $ input , $ key , $ match , $ lang ) { $ lang = $ this -> custom ( 'match' , $ lang ) ; if ( $ input [ $ key ] !== $ input [ $ match ] ) { return preg_replace_callback ( '/(\:field)(.*)(\:match)/i' , function ( $ m ) use ( $ key , $ match ) { return $ key . $ m [ 2 ] . $ match ; } , $ lang ) ; }...
Parses a match validation field .
232,750
public function email ( $ input , $ key , $ lang ) { $ lang = $ this -> custom ( 'email' , $ lang ) ; if ( filter_var ( $ input [ $ key ] , FILTER_VALIDATE_EMAIL ) === false ) { return str_replace ( ':field' , $ key , $ lang ) ; } }
Parses an email validation field .
232,751
public function url ( $ input , $ key , $ lang ) { $ lang = $ this -> custom ( 'url' , $ lang ) ; if ( filter_var ( $ input [ $ key ] , FILTER_VALIDATE_URL ) === false ) { return str_replace ( ':field' , $ key , $ lang ) ; } }
Parses URL validation field .
232,752
public function min ( $ input , $ key , $ min , $ lang ) { $ lang = $ this -> custom ( 'min' , $ lang ) ; if ( strlen ( $ input [ $ key ] ) < $ min ) { return preg_replace_callback ( '/(:field)(.*)(\:num)/i' , function ( $ m ) use ( $ key , $ min ) { return $ key . $ m [ 2 ] . $ min ; } , $ lang ) ; } }
Parses a set minimum number of characters .
232,753
public function max ( $ input , $ key , $ max , $ lang ) { $ lang = $ this -> custom ( 'max' , $ lang ) ; if ( strlen ( $ input [ $ key ] ) > $ max ) { return preg_replace_callback ( '/(:field)(.*)(\:num)/i' , function ( $ m ) use ( $ key , $ max ) { return $ key . $ m [ 2 ] . $ max ; } , $ lang ) ; } }
Parses a set maximum number of characters .
232,754
public function from ( $ input , $ key , $ rule , $ lang ) { $ lang = $ this -> custom ( 'from' , $ lang ) ; $ db = new Database ( ) ; $ cap = $ db -> getCapsule ( ) ; $ exp = explode ( ':' , $ rule ) ; $ table = $ cap -> table ( $ exp [ 1 ] ) ; if ( $ table -> where ( $ exp [ 2 ] , '=' , $ input [ $ key ] ) -> count (...
Checks if a given field exists in given database table .
232,755
protected function setQueryController ( $ namespace , $ crud_type = 'Read' ) { $ options = $ this -> setQueryOptions ( $ crud_type ) ; try { $ this -> query = $ this -> resource -> get ( 'query://' . $ namespace , $ options ) ; } catch ( Exception $ e ) { throw new RuntimeException ( $ e -> getMessage ( ) ) ; } return ...
Set Query Controller
232,756
protected function setQueryOptions ( $ crud_type = 'Read' ) { $ options = array ( ) ; $ crud_type = ucfirst ( strtolower ( $ crud_type ) ) ; if ( $ crud_type === 'Create' || $ crud_type === 'Read' || $ crud_type === 'Update' || $ crud_type === 'Delete' ) { } else { $ crud_type = 'Read' ; } $ options [ 'crud_type' ] = $...
Set Query Options
232,757
protected function setQueryControllerDefaults ( $ process_events = 0 , $ query_object = 'item' , $ get_customfields = 0 , $ use_special_joins = 0 , $ use_pagination = 0 , $ check_view_level_access = 0 , $ get_item_children = 0 ) { $ this -> query -> setModelRegistry ( 'process_events' , $ process_events ) ; $ this -> q...
Set Query Controller Default Values
232,758
protected function setModelRegistryCriteria ( ) { $ prefix = $ this -> query -> getModelRegistry ( 'primary_prefix' , 'a' ) ; $ this -> setModelRegistryCatalogTypeIdCriteria ( $ prefix ) ; $ this -> setModelRegistryExtensionInstanceIdCriteria ( $ prefix ) ; $ this -> setModelRegistryMenuIdCriteria ( $ prefix ) ; $ this...
Set Standard Model Registry Criteria
232,759
protected function setStandardFields ( $ data , array $ model_registry = array ( ) ) { $ fields = $ model_registry [ 'fields' ] ; $ this -> customfieldgroups = $ model_registry [ 'customfieldgroups' ] ; $ base = $ this -> processQueryFields ( $ data , $ fields ) ; return $ this -> sortObject ( $ base ) ; }
Set Standard Fields
232,760
protected function setCustomFields ( $ base , $ data , array $ model_registry = array ( ) ) { if ( count ( $ this -> customfieldgroups ) > 0 ) { } else { return $ base ; } foreach ( $ this -> customfieldgroups as $ group ) { $ group_data = $ this -> processQueryFields ( json_decode ( $ data -> $ group ) , $ model_regis...
Set Custom Fields
232,761
protected function verifyFieldDefined ( $ key , $ field ) { if ( count ( $ field ) === 0 ) { throw new RuntimeException ( get_class ( $ this ) . ' Field: ' . $ key . ' not defined ' . ' in QueryUsageTrait::processQueryFields.' ) ; } return $ this ; }
Verify Field is Defined
232,762
protected function setFieldValue ( $ key , $ data , $ default = null ) { $ value = null ; if ( isset ( $ data -> $ key ) ) { $ value = $ data -> $ key ; } if ( $ value === null ) { $ value = $ default ; } return $ value ; }
Set Value for Field
232,763
protected function sortObject ( $ object ) { $ sort_array = get_object_vars ( $ object ) ; ksort ( $ sort_array ) ; $ new_object = new stdClass ( ) ; foreach ( $ sort_array as $ key => $ value ) { if ( is_object ( $ value ) ) { $ value = $ this -> sortObject ( $ value ) ; } $ new_object -> $ key = $ value ; } unset ( $...
Sort an object
232,764
public function sign ( $ data ) { $ privateKeyResource = openssl_pkey_get_private ( 'file://' . $ this -> filePath ) ; $ signature = null ; openssl_sign ( $ data , $ signature , $ privateKeyResource ) ; openssl_free_key ( $ privateKeyResource ) ; return $ signature ; }
Sign some data with this private key .
232,765
public function editSettings ( ) { $ this -> setTitleEditSettings ( ) ; $ this -> setBreadcrumbEditSettings ( ) ; $ this -> setData ( 'statuses' , $ this -> order -> getStatuses ( ) ) ; $ this -> setData ( 'settings' , $ this -> module -> getSettings ( 'twocheckout' ) ) ; $ this -> submitSettings ( ) ; $ this -> output...
Route page callback to display module settings form
232,766
public function toXml ( ) { $ result = '' ; $ tagName = ( $ this -> namespace == '' ? '' : $ this -> namespace . ':' ) . $ this -> name ; $ attributes = '' ; foreach ( $ this -> attributes as $ attribute ) { $ attributes .= ' ' . $ attribute -> Name . '="' . $ attribute -> Value . '"' ; } $ result .= '<' . $ tagName . ...
Convert to XML .
232,767
final public function getAllValues ( ) { $ subClass = get_called_class ( ) ; if ( isset ( $ this -> _cachedEnums [ $ subClass ] ) ) { return FALSE ; } $ reflection = new \ ReflectionClass ( $ subClass ) ; return $ reflection -> getConstants ( ) ; }
Return all populated arrays
232,768
public function afterMethodExecution ( MethodInvocation $ invocation ) { $ filesystemAdapter = new Local ( APP_BASE_DIR . 'storage/cache/api/' ) ; $ filesystem = new Filesystem ( $ filesystemAdapter ) ; $ pool = new FilesystemCachePool ( $ filesystem ) ; $ cacheKey = "products_" . md5 ( implode ( '_' , $ invocation -> ...
Cache bridge file response
232,769
public function reload ( ) : void { $ config = [ ] ; foreach ( $ this -> configSources as $ src ) { if ( is_string ( $ src ) ) { if ( is_dir ( $ src ) ) { $ getConfigFiles = function ( string $ path ) use ( & $ getConfigFiles ) { $ fragments = [ ] ; if ( is_dir ( $ path ) ) { $ d = dir ( $ path ) ; while ( ( $ f = $ d ...
Reload the config from it s sources ( usually done on SIGHUP to load in configuration changes in files
232,770
protected function parseConfig ( string $ config ) : array { $ config = json_decode ( $ config , true ) ; if ( $ config === null ) { throw new ConfigFileFormatException ( "Config files should be written in valid JSON" ) ; } return $ config ; }
An overridable method that allows parsing arbitrary strings into config arrays
232,771
public function actionIndex ( $ lang = '' ) { $ model = new InstallForm ( ) ; if ( ! empty ( $ lang ) ) { Yii :: $ app -> language = $ lang ; $ model -> language = $ lang ; } if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> validate ( ) ) { $ this -> createEnvFile ( $ model ) ; Yii :: $ app ->...
Display the install form
232,772
protected function processMigrations ( ) { $ messages = '' ; $ migrationsPaths = [ '@vendor/dektrium/yii2-user/migrations' , '@yii/rbac/migrations' , '@pheme/settings/migrations' , ] ; foreach ( $ migrationsPaths as $ path ) { $ migration = new Migration ( Yii :: getAlias ( $ path ) ) ; $ migration -> up ( ) ; $ messag...
Process required migrations
232,773
protected function createEnvFile ( InstallForm $ model ) { $ envFile = Yii :: getAlias ( '@app/.env' ) ; if ( ! file_exists ( $ envFile ) ) { $ dsn = '' ; $ buffer = "\n" ; $ cookieKey = $ this -> generateRandomString ( ) ; $ buffer .= "YII_DEBUG = 0\n" ; $ buffer .= "YII_ENV = prod\n" ; $ buffer .= "...
Create the application env file
232,774
protected function callModulesMethod ( $ methodName ) { $ modules = Yii :: $ app -> getModules ( ) ; $ returns = [ ] ; foreach ( $ modules as $ moduleName => $ module ) { if ( is_array ( $ module ) ) { $ module = Yii :: $ app -> getModule ( $ moduleName ) ; } if ( method_exists ( $ module , $ methodName ) ) { $ returns...
Call a method if exists on every application modules
232,775
protected function shouldWriteOutput ( $ min = 0 , $ max = null ) { $ out = $ this -> getOutput ( ) ; if ( ! $ out instanceof OutputInterface ) { return false ; } $ v = $ out -> getVerbosity ( ) ; return ! ( $ v < $ min || ( $ max !== null && $ v > $ max ) ) ; }
Checks if the output verbositiy is between two given levels
232,776
protected function writeOutputLine ( $ msg , $ min = 0 , $ max = null ) { if ( ! $ this -> shouldWriteOutput ( $ min , $ max ) ) { return ; } $ this -> getOutput ( ) -> writeln ( $ msg ) ; }
Prints a text line if the output verbositiy is between two given levels
232,777
protected function writeOutput ( $ msg , $ min = 0 , $ max = null ) { if ( ! $ this -> shouldWriteOutput ( $ min , $ max ) ) { return ; } return $ this -> getOutput ( ) -> write ( $ msg ) ; }
Prints a text if the output verbositiy is between two given levels
232,778
public function makeComponent ( array $ attributes = [ ] , string $ innerHTML = '' , string $ tagName = 'component' ) { $ app = App :: get ( ) ; if ( self :: $ newComponentCache === null ) { self :: $ newComponentCache = new \ IvoPetkov \ BearFramework \ Addons \ HTMLServerComponents \ Internal \ Component ( ) ; } $ co...
Constructs a component object
232,779
public function getPasses ( ) { return array_merge ( array ( $ this -> mergePass ) , $ this -> getBeforeOptimizationPasses ( ) , $ this -> getOptimizationPasses ( ) , $ this -> getBeforeRemovingPasses ( ) , $ this -> getRemovingPasses ( ) , $ this -> getAfterRemovingPasses ( ) ) ; }
Returns all passes in order to be processed .
232,780
public static function ensure ( ) { $ cnt = 0 ; foreach ( self :: $ instances as $ instance ) { if ( ! $ instance -> isAlive ( ) ) { $ instance -> reset ( ) ; $ cnt ++ ; } } return $ cnt ; }
Ensure all known non terminated resource objects are golden
232,781
public function unserialize ( $ data ) { $ connectionSettings = new ConnectionSettings ( json_decode ( $ data , true ) ) ; $ this -> __construct ( $ connectionSettings ) ; }
Unserialize . Object .
232,782
public function isTerminated ( $ throwExceptionIfTerminated = true ) { if ( $ this -> terminated ) { if ( $ throwExceptionIfTerminated ) { throw new ConnectionTerminatedException ( $ this ) ; } return true ; } return false ; }
Has this resource been terminated?
232,783
public function get ( $ reconnectOnFailure = false ) { if ( $ reconnectOnFailure and ! $ this -> isAlive ( ) ) { $ this -> reset ( ) ; } return $ this -> resource ; }
Return the pglink resource .
232,784
public function createInstance ( Binding $ binding , InjectionPointInterface $ point = NULL ) { switch ( $ binding -> getOptions ( ) & BindingInterface :: MASK_TYPE ) { case BindingInterface :: TYPE_ALIAS : return $ this -> get ( $ binding -> getTarget ( ) , $ point ) ; case BindingInterface :: TYPE_FACTORY : case Bind...
Create an instance of the bound type will NOT create or re - use a scoped proxy .
232,785
protected function createObjectUsingFactory ( Binding $ binding , InjectionPointInterface $ point = NULL ) { $ callback = $ binding -> getTarget ( ) ; if ( is_array ( $ callback ) ) { $ callback = [ $ this -> get ( $ callback [ 0 ] ) , $ callback [ 1 ] ] ; $ ref = new \ ReflectionMethod ( get_class ( $ callback [ 0 ] )...
Create an object using the factory defined in the given binding .
232,786
protected function registerBindings ( array $ bindings ) { foreach ( $ bindings as $ binding ) { $ this -> bindings [ ( string ) $ binding ] = $ binding ; foreach ( $ binding -> getMarkers ( ) as $ marker ) { $ marker = get_class ( $ marker ) ; if ( empty ( $ this -> markers [ $ marker ] ) ) { $ this -> markers [ $ mar...
Register the given bindings with the container and prepare markers .
232,787
public function advance ( $ step = 1 , $ redraw = false ) { parent :: advance ( $ step , $ redraw ) ; $ this -> current += $ step ; $ percent = 0 ; if ( $ this -> max > 0 ) { $ percent = ( float ) $ this -> current / $ this -> max ; } $ this -> output -> write ( sprintf ( '%d%%' , floor ( $ percent * 100 ) ) ) ; }
Advances the progress output X steps .
232,788
public function addConnection ( Base $ connection = null , $ name = '' ) { if ( $ connection instanceof Base ) { if ( $ name !== '' ) { $ this -> connections [ $ name ] = $ connection ; } else { $ this -> connections [ ] = $ connection ; } } else { throw new CapsuleInstanceException ( sprintf ( 'Connection variable mus...
add a connection to capsule
232,789
public function deleteConnection ( $ offset ) { if ( isset ( $ this -> connections [ $ offset ] ) ) { unset ( $ this -> connections [ $ offset ] ) ; } return $ this ; }
delete a connection in capsule
232,790
public static function generateProductVariantCode ( ProductInterface $ product , array $ productOptions ) : CodeInterface { $ productVariantCodeGenerator = new ProductVariantCodeGenerator ( ) ; return $ productVariantCodeGenerator -> generate ( $ product -> getCode ( ) , $ productOptions ) ; }
Generate product variant code .
232,791
public function commentsFilter ( ) { $ post_types = get_post_types ( ) ; foreach ( $ post_types as & $ post_type ) { if ( post_type_supports ( $ post_type , 'comments' ) ) { $ post_type_obj = get_post_type_object ( $ post_type ) ; $ post_type = array ( 'name' => $ post_type_obj -> name , 'label' => $ post_type_obj -> l...
Filter comments by post type
232,792
public function queryFilter ( $ query ) { global $ pagenow ; if ( ! is_admin ( ) || ! $ pagenow || $ pagenow !== 'edit-comments.php' || ! isset ( $ _GET [ 'post_type' ] ) || ! $ _GET [ 'post_type' ] ) { return ; } $ query -> set ( 'post_type' , $ _GET [ 'post_type' ] ) ; }
Filter the wp query
232,793
public function tableColumnsContent ( $ column , $ postId ) { if ( $ column == 'post_type' ) { $ comment = get_comment ( $ postId , OBJECT ) ; $ post_type_slug = get_post_type ( $ comment -> comment_post_ID ) ; $ post_type_obj = get_post_type_object ( $ post_type_slug ) ; echo $ post_type_obj -> label ; } }
Content for table columns
232,794
protected function getFileModifiedTimestampOfFile ( $ fileName , $ format = 'Y-m-d H:i:s' , $ resultInUtc = false ) { if ( ! file_exists ( $ fileName ) ) { return [ 'error' => $ fileName . ' was not found' ] ; } $ info = new \ SplFileInfo ( $ fileName ) ; if ( $ format === 'PHPtime' ) { return $ info -> getMTime ( ) ; ...
Returns Modified date and time of a given file
232,795
protected function getPackageDetailsFromGivenComposerLockFileEnhanced ( $ fileIn , $ inParametersArray = [ ] ) { if ( ! file_exists ( $ fileIn ) ) { return [ 'error' => $ fileIn . ' was not found' ] ; } $ alnfo = [ ] ; $ packages = $ this -> getPkgFileInListOfPackageArrayOut ( $ fileIn ) ; $ pkgType = $ this -> decisio...
Returns a complete list of packages and respective details from a composer . lock file
232,796
public function setEmpty ( ) { $ this -> name = $ this -> ANSICode = $ this -> XTermCode = $ this -> RGB = null ; }
Set the color object to empty
232,797
public function isEmpty ( ) { return ( is_null ( $ this -> name ) && is_null ( $ this -> ANSICode ) && is_null ( $ this -> XTermCode ) && is_null ( $ this -> RGB ) ) ; }
Return whether the object is empty
232,798
public function setColor ( $ color ) { if ( ! is_null ( $ color ) ) { if ( $ color instanceof ColorInterface ) { $ this -> name = $ color -> getName ( ) ; $ this -> XTermCode = $ color -> getXTermCode ( ) ; $ this -> RGB = $ color -> getRGB ( ) ; $ this -> ANSICode = $ color -> getANSICode ( ) ; } else if ( is_string (...
The variety of ways to set a color
232,799
public function generateColorCoding ( $ mode , $ isFill = false ) { $ codes = "" ; if ( $ this -> isValid ( ) ) { $ mode = new Mode ( $ mode ) ; $ base = 0 ; if ( $ isFill ) { $ base = 10 ; } switch ( $ mode -> getMode ( ) ) { case Mode :: VT100 : $ codes = ( $ base + $ this -> getANSICode ( ) ) . "" ; break ; case Mod...
Generate a color coding based on the terminal type