idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
400 | private static function myParse ( string $ emailAddress , ? string & $ username = null , ? HostInterface & $ host = null , ? string & $ error = null ) : bool { if ( $ emailAddress === '' ) { $ error = 'Email address "" is empty.' ; return false ; } $ parts = explode ( '@' , $ emailAddress , 2 ) ; if ( count ( $ parts )... | Tries to parse an email address and returns the result or error text . |
401 | private static function myParseHostname ( string $ hostname , ? HostInterface & $ host = null , ? string & $ error = null ) : bool { if ( strlen ( $ hostname ) > 2 && substr ( $ hostname , 0 , 1 ) === '[' && substr ( $ hostname , - 1 ) === ']' ) { $ ipAddress = substr ( $ hostname , 1 , - 1 ) ; try { $ host = Host :: f... | Parses the hostname . |
402 | private static function myValidateUsername ( string $ username , ? string & $ error = null ) : bool { if ( $ username === '' ) { $ error = 'Username "" is empty.' ; return false ; } if ( strpos ( $ username , '..' ) !== false ) { $ error = 'Username "' . $ username . '" contains "..".' ; return false ; } if ( strlen ( ... | Validates the username . |
403 | public function request ( ) { if ( ENOLA_MODE == 'HTTP' ) { $ this -> loadHttpModule ( ) ; } else { $ this -> loadCronModule ( ) ; } $ this -> view = new Support \ View ( ) ; $ this -> loadUserConfig ( ) ; if ( ENOLA_MODE == 'HTTP' ) { $ this -> httpCore -> executeHttpRequest ( ) ; } else { $ this -> cronCore -> execut... | Responde al requerimiento analizando el tipo del mismo HTTP CLI ETC . |
404 | protected function loadFunctionsFiles ( ) { require $ this -> context -> getPathFra ( ) . 'Support/fn_error.php' ; require $ this -> context -> getPathFra ( ) . 'Support/fn_load_files.php' ; require $ this -> context -> getPathFra ( ) . 'Support/fn_view.php' ; } | Carga de modulos de soporte para que el framework trabaje correctamente |
405 | protected function loadLibraries ( ) { foreach ( $ this -> context -> getLibrariesDefinition ( ) as $ libreria ) { $ dir = $ libreria [ 'path' ] ; Support \ import_librarie ( $ dir ) ; } } | Carga todas las librerias particulares de la aplicacion que se cargaran automaticamente indicadas en el archivo de configuracion |
406 | protected function loadCronModule ( ) { global $ argv , $ argc ; if ( $ argc >= 2 ) { $ this -> cronCore = new Cron \ CronCore ( $ this , $ argv ) ; } else { Error :: general_error ( 'Cron Controller' , 'There isent define any cron controller name' ) ; } } | Carga el modulo cron y ejecuta el Cron correspondiente |
407 | public function getRequest ( ) { if ( $ this -> httpCore != NULL ) { return $ this -> httpCore -> httpRequest ; } else { return $ this -> cronCore -> cronRequest ; } } | Retorna el Requerimiento actual |
408 | public function getResponse ( ) { if ( $ this -> httpCore != NULL ) { return $ this -> httpCore -> httpResponse ; } else { return $ this -> cronCore -> cronResponse ; } } | Retorna el Response actual |
409 | public function setAttribute ( $ key , $ value ) { return $ this -> cache -> store ( $ this -> prefixApp . $ key , $ value ) ; } | Guarda un atributo en cache a nivel aplicacion . Por tiempo indefinido . |
410 | public function setObject ( $ object ) { if ( ! is_object ( $ object ) ) { throw new Exception \ InvalidArgumentException ( sprintf ( '%s expects an object argument; received "%s"' , __METHOD__ , gettype ( $ object ) ) ) ; } if ( property_exists ( $ this , 'hydrator' ) && $ this -> hydrator ) { $ values = $ this -> get... | Set the object used by the hydrator |
411 | public function onPostInstall ( Event $ event ) { $ lockFile = new JsonFile ( $ this -> lockFile ) ; if ( $ lockFile -> exists ( ) ) { $ this -> loadPackages ( $ lockFile ) ; } else { $ this -> scanPackages ( ) ; } $ this -> runAction ( 'install' ) ; } | Perform install . Called by composer after install . |
412 | public function findPackage ( $ name , $ composer = null ) { if ( $ composer === null ) { $ composer = $ this -> composer ; } return $ this -> composer -> getRepositoryManager ( ) -> findPackage ( 'beelab/bowerphp' , '*' ) ; } | Returns package with given name if exists . |
413 | protected function scanPackages ( ) { $ rootPackage = $ this -> composer -> getPackage ( ) ; if ( $ rootPackage ) { $ extra = $ rootPackage -> getExtra ( ) ; foreach ( $ this -> managers as $ manager ) { $ var = $ manager -> getName ( ) . '-asset-library' ; if ( isset ( $ extra [ 'asset-installer-paths' ] [ $ var ] ) )... | Scan packages from the composer objects . |
414 | protected function loadPackages ( JsonFile $ lockFile ) { $ lock = $ lockFile -> read ( ) ; foreach ( $ this -> managers as $ name => $ m ) { $ m -> setConfig ( $ lock [ $ name ] ) ; } } | Load packages from given lock file . |
415 | private function addSchema ( Schema $ schema ) { if ( array_key_exists ( $ schema -> getName ( ) , $ this -> schemas ) ) { throw new \ Exception ( sprintf ( 'Schema "%s" is allready registered.' , $ schema -> getName ( ) ) ) ; } $ this -> schemas [ $ schema -> getName ( ) ] = $ schema ; return $ this ; } | Adds a schema . |
416 | private function load ( ) { if ( $ this -> loaded ) { return $ this ; } if ( 0 == count ( $ this -> dirs ) ) { return $ this ; } $ loaderResolver = new LoaderResolver ( array ( new YamlLoader ( ) ) ) ; $ loader = new DelegatingLoader ( $ loaderResolver ) ; $ finder = new Finder ( ) ; $ finder -> files ( ) -> in ( $ thi... | Loads the schemas . |
417 | public function single ( $ sql , $ params = array ( ) ) { $ query = $ this -> query ( $ sql , $ params ) ; $ data = $ query -> fetch ( ) ; return isset ( $ data [ 0 ] ) ? $ data [ 0 ] : null ; } | Execute a query and return the first value found . Note that this function returns null when no value is found but can also return null where the first value found in the DB is null . |
418 | public function insert ( $ sql , $ params = array ( ) ) { $ this -> query ( $ sql , $ params ) ; return $ this -> pdo -> lastInsertId ( ) ; } | Execute a query and return the insert ID |
419 | public function get ( $ key = null ) { if ( $ key === null ) { return $ this -> config ; } else { $ keys = ( strpos ( $ key , ' ' ) !== false ) ? explode ( ' ' , $ key ) : [ $ key ] ; $ value = $ this -> config ; foreach ( $ keys as $ key ) { if ( ! array_key_exists ( $ key , $ value ) ) { throw new \ Exception ( sprin... | Get array of values or filter down to specific key . |
420 | public function & __get ( $ name ) { switch ( $ name ) { case 'global' : if ( is_null ( static :: $ global ) ) { static :: $ global = new Container ; } return static :: $ global ; break ; case 'session' : if ( is_null ( static :: $ session ) ) { static :: $ session = new Session ; } return static :: $ session ; break ;... | A magic getter for our private properties . |
421 | public function tag ( $ name , array $ attributes , $ content = null ) { $ args = func_get_args ( ) ; $ tag = array_shift ( $ args ) ; $ attributes = array_shift ( $ args ) ; foreach ( $ attributes as $ key => $ value ) { if ( is_array ( $ value ) ) { $ value = implode ( ' ' , array_unique ( array_filter ( $ value ) ) ... | Generate an HTML tag programatically . |
422 | public function id ( $ prefix = '' ) { static $ id = 0 ; ++ $ id ; $ result = '' ; $ lookup = array ( 'M' => 1000 , 'CM' => 900 , 'D' => 500 , 'CD' => 400 , 'C' => 100 , 'XC' => 90 , 'L' => 50 , 'XL' => 40 , 'X' => 10 , 'IX' => 9 , 'V' => 5 , 'IV' => 4 , 'I' => 1 ) ; $ number = $ id ; if ( $ number < 100 ) { $ lookup =... | We use this in the Form component to avoid input name collisions . We use it in the Bootstrap component for accordions carousels and the like . The problem with just incrementing a number and adding it onto something else is that css and jQuery don t like numbered id s . So we use roman numerals instead and that solves... |
423 | public function filter ( $ section , callable $ function , array $ params = array ( 'this' ) , $ order = 10 ) { if ( $ section == 'response' ) { foreach ( $ params as $ key => $ value ) { if ( empty ( $ value ) || $ value == 'this' ) { unset ( $ params [ $ key ] ) ; } } $ key = false ; } elseif ( ! in_array ( $ section... | Enables you to modify just about anything throughout the creation process of your page . |
424 | public function commonDir ( array $ files ) { $ files = array_values ( $ files ) ; $ cut = 0 ; $ count = count ( $ files ) ; $ shortest = min ( array_map ( 'mb_strlen' , $ files ) ) ; while ( $ cut < $ shortest ) { $ char = $ files [ 0 ] [ $ cut ] ; for ( $ i = 1 ; $ i < $ count ; ++ $ i ) { if ( $ files [ $ i ] [ $ cu... | An internal method we use that comes in handy elsewhere as well . |
425 | protected function redirect ( ) { $ redirect = false ; $ file = $ this -> file ( '301.txt' ) ; if ( is_file ( $ file ) ) { $ map = array ( ) ; foreach ( array_filter ( array_map ( 'trim' , file ( $ file ) ) ) as $ url ) { if ( $ url [ 0 ] == '[' && substr ( $ url , - 1 ) == ']' ) { $ new = substr ( $ url , 1 , - 1 ) ; ... | Determine if the current page requires a 301 redirect . |
426 | public function fromFile ( string $ filename = '' , bool $ returnArray = false ) { if ( empty ( $ filename ) ) { throw new InvalidArgumentException ( 'File name must be specified' ) ; } \ set_error_handler ( function ( $ error , $ message = '' ) use ( $ filename ) { $ exMsg = \ sprintf ( 'Error reading from "%s": %s' ,... | Reads configuration from file and converts it to array |
427 | public function persist ( $ model , $ errors = array ( ) , $ data = array ( ) ) { if ( is_a ( $ model , 'Model' ) ) { $ errors = $ model -> validationErrors ; $ data = $ model -> data ; $ model = $ model -> alias ; } return $ this -> Session -> write ( "$this->sessionKey.$model" , compact ( 'data' , 'errors' ) ) ; } | Manually force errors to persist . |
428 | public function build ( ) { foreach ( $ this -> modules -> enabled ( ) as $ module ) { $ name = studly_case ( $ module -> getName ( ) ) ; $ class = 'Modules\\' . $ name . '\\MenuExtenders\\SidebarExtender' ; if ( class_exists ( $ class ) ) { $ extender = $ this -> container -> make ( $ class ) ; $ this -> menu -> add (... | Build your sidebar implementation here . |
429 | public function get ( $ key , $ expiration = false ) { $ item = $ this -> psr6Cache -> getItem ( $ key ) ; return $ item -> isHit ( ) ? $ item -> get ( ) : false ; } | Retrieves the data for the given key or false if they key is unknown or expired |
430 | public function description ( ) { if ( substr ( $ this -> description , 0 , 5 ) == 'lang:' ) { $ description = substr ( $ this -> description , 5 ) ; if ( $ desc = $ this -> CI -> lang -> line ( $ description ) ) { return $ desc ; } return $ description ; } return $ this -> description ; } | Get command description |
431 | public function findChild ( $ id ) { foreach ( $ this -> getChildren ( ) as $ child ) { $ result = $ this -> findChildInNode ( $ child , $ id ) ; if ( $ result ) { return $ result ; } } return null ; } | Find a child item by id |
432 | public static function groupByColumn ( array $ array , $ keyColumn , $ valueColumn = null ) : array { $ result = [ ] ; foreach ( $ array as $ item ) { if ( ! isset ( $ item [ $ keyColumn ] ) ) { continue ; } $ key = $ item [ $ keyColumn ] ; if ( ! isset ( $ result [ $ key ] ) ) { $ result [ $ key ] = [ ] ; } if ( null ... | Group array items by column . |
433 | public static function columnToKey ( array $ array , $ keyColumn , $ valueColumn = null ) : array { $ keys = array_column ( $ array , $ keyColumn ) ; $ values = null === $ valueColumn ? $ array : array_column ( $ array , $ valueColumn ) ; return array_combine ( $ keys , $ values ) ; } | Creates an array where the column is used as keys . |
434 | public static function searchByColumnValue ( array $ array , $ column , $ value , bool $ strict = false ) { foreach ( $ array as $ row ) { if ( ! $ strict && $ row [ $ column ] == $ value ) { return $ row ; } elseif ( $ strict && $ row [ $ column ] === $ value ) { return $ row ; } } return null ; } | Returns the array element where the column is equal to the specified value . |
435 | private function clearSigHandlers ( ) { pcntl_signal ( SIGTERM , SIG_DFL ) ; pcntl_signal ( SIGINT , SIG_DFL ) ; pcntl_signal ( SIGQUIT , SIG_DFL ) ; pcntl_signal ( SIGUSR1 , SIG_DFL ) ; pcntl_signal ( SIGUSR2 , SIG_DFL ) ; pcntl_signal ( SIGCONT , SIG_DFL ) ; } | Clear all previously registered signal handlers |
436 | private function fork ( & $ socket ) { $ pair = [ ] ; if ( socket_create_pair ( AF_UNIX , SOCK_STREAM , 0 , $ pair ) === false ) { $ this -> logger -> error ( '{type}: Unable to create socket pair; ' . socket_strerror ( socket_last_error ( $ pair [ 0 ] ) ) , $ this -> logContext ) ; exit ( 0 ) ; } $ PID = Qless :: fork... | Forks and creates a socket pair for communication between parent and child process |
437 | protected function timestamped_endpoint ( $ url ) { $ time = substr ( date_i18n ( 'YmdHi' , false , true ) , 0 , - 1 ) . '0' ; return add_query_arg ( [ 'timestamp' => $ time , ] , $ url ) ; } | Add timestamp for endpoint . |
438 | protected function parse_result ( $ response ) { if ( is_wp_error ( $ response ) ) { return ( object ) [ 'success' => false , 'version' => false , 'error' => $ response -> get_error_code ( ) , 'message' => $ response -> get_error_message ( ) , ] ; } else { $ result = json_decode ( $ response ) ; if ( is_null ( $ result... | Parse result from remote server . |
439 | protected function remote_get_version ( ) { $ key = $ this -> cache_key ; $ version = get_site_transient ( $ key ) ; if ( false !== $ version ) { return $ version ; } $ url = $ this -> timestamped_endpoint ( $ this -> endpoint ( ) ) ; $ response = wp_remote_get ( $ url ) ; if ( is_wp_error ( $ response ) ) { $ version ... | Get remote version file . |
440 | public function has_update ( ) { $ info = $ this -> remote_get_version ( ) ; if ( ! isset ( $ info -> version ) || ! $ info -> version ) { return false ; } else { return version_compare ( $ this -> version , $ info -> version , '<' ) ; } } | Detect if plugin has update . |
441 | public function wp_get_update_data ( $ update_data , $ titles ) { if ( $ this -> has_update ( ) ) { $ update_data [ 'counts' ] [ 'plugins' ] ++ ; $ update_data [ 'counts' ] [ 'total' ] ++ ; $ titles [ 'plugins' ] = sprintf ( _n ( '%d Plugin Update' , '%d Plugin Updates' , $ update_data [ 'counts' ] [ 'plugins' ] , 'ham... | Update message . |
442 | public function activate ( Composer $ composer , IOInterface $ io ) { $ this -> package = $ composer -> getPackage ( ) ; $ this -> io = $ io ; $ this -> projectRoot = realpath ( dirname ( $ composer -> getConfig ( ) -> get ( 'vendor-dir' ) ) ) ; } | Activate Wordpress plugin |
443 | public function initialiseWordpress ( Event $ event ) { $ webroot = $ this -> getWebroot ( ) ; $ defaultSettings = array ( 'copy-paths' => array ( ) ) ; $ extraConfig = $ this -> package -> getExtra ( ) ; if ( ! isset ( $ extraConfig [ 'wordpress' ] ) ) { $ extraConfig [ 'wordpress' ] = array ( ) ; } $ settings = array... | Initialise the project |
444 | public function getDispatcherFactory ( ContainerInterface $ container ) : DispatcherFactoryInterface { $ autowired = $ container -> get ( 'ellipse.dispatcher.autowiring.status' ) ; if ( $ autowired ) { $ interfaces = $ container -> get ( 'ellipse.dispatcher.autowiring.interfaces' ) ; $ container = new ReflectionContain... | Return an instance of default resolver as DispatcherFactoryInterface . |
445 | public function Initialize ( ) { parent :: Initialize ( ) ; Gdn_Theme :: Section ( 'Dashboard' ) ; if ( $ this -> Menu ) $ this -> Menu -> HighlightRoute ( '/dashboard/settings' ) ; } | Hightlight menu path . Automatically run on every use . |
446 | public function Homepage ( ) { $ this -> Permission ( 'Garden.Settings.Manage' ) ; $ this -> AddSideMenu ( 'dashboard/settings/homepage' ) ; $ this -> Title ( T ( 'Homepage' ) ) ; $ CurrentRoute = GetValue ( 'Destination' , Gdn :: Router ( ) -> GetRoute ( 'DefaultController' ) , '' ) ; $ this -> SetData ( 'CurrentTarge... | Homepage management screen . |
447 | public function Email ( ) { $ this -> Permission ( 'Garden.Settings.Manage' ) ; $ this -> AddSideMenu ( 'dashboard/settings/email' ) ; $ this -> AddJsFile ( 'email.js' ) ; $ this -> Title ( T ( 'Outgoing Email' ) ) ; $ Validation = new Gdn_Validation ( ) ; $ ConfigurationModel = new Gdn_ConfigurationModel ( $ Validatio... | Outgoing Email management screen . |
448 | public function xIndex ( ) { $ this -> AddJsFile ( 'settings.js' ) ; $ this -> Title ( T ( 'Dashboard' ) ) ; $ this -> RequiredAdminPermissions [ ] = 'Garden.Settings.Manage' ; $ this -> RequiredAdminPermissions [ ] = 'Garden.Users.Add' ; $ this -> RequiredAdminPermissions [ ] = 'Garden.Users.Edit' ; $ this -> Required... | Main dashboard . |
449 | public function AddUpdateCheck ( ) { if ( C ( 'Garden.NoUpdateCheck' ) ) return ; $ UpdateCheckDate = Gdn :: Config ( 'Garden.UpdateCheckDate' , '' ) ; if ( $ UpdateCheckDate == '' || ! IsTimestamp ( $ UpdateCheckDate ) || $ UpdateCheckDate < strtotime ( "-1 day" ) ) { $ UpdateData = array ( ) ; $ Plugins = Gdn :: Plug... | Adds information to the definition list that causes the app to phone home and see if there are upgrades available . |
450 | public function Plugins ( $ Filter = '' , $ PluginName = '' , $ TransientKey = '' ) { $ this -> Permission ( 'Garden.Settings.Manage' ) ; $ this -> AddJsFile ( 'addons.js' ) ; $ this -> Title ( T ( 'Plugins' ) ) ; $ this -> AddSideMenu ( 'dashboard/settings/plugins' ) ; $ Session = Gdn :: Session ( ) ; $ PluginName = $... | Manage list of plugins . |
451 | public static function SortAddons ( & $ Array , $ Filter = TRUE ) { foreach ( $ Array as $ Key => $ Value ) { if ( $ Filter && GetValue ( 'Hidden' , $ Value ) ) { unset ( $ Array [ $ Key ] ) ; continue ; } $ Name = GetValue ( 'Name' , $ Value , $ Key ) ; SetValue ( 'Name' , $ Array [ $ Key ] , $ Name ) ; } uasort ( $ A... | Sort list of addons for display . |
452 | public function ThemeOptions ( $ Style = NULL ) { $ this -> Permission ( 'Garden.Settings.Manage' ) ; try { $ this -> AddJsFile ( 'addons.js' ) ; $ this -> AddSideMenu ( 'dashboard/settings/themeoptions' ) ; $ ThemeManager = new Gdn_ThemeManager ( ) ; $ this -> SetData ( 'ThemeInfo' , $ ThemeManager -> EnabledThemeInfo... | Manage options for a theme . |
453 | public function Themes ( $ ThemeName = '' , $ TransientKey = '' ) { $ this -> AddJsFile ( 'addons.js' ) ; $ this -> SetData ( 'Title' , T ( 'Themes' ) ) ; $ this -> Permission ( 'Garden.Settings.Manage' ) ; $ this -> AddSideMenu ( 'dashboard/settings/themes' ) ; $ ThemeInfo = Gdn :: ThemeManager ( ) -> EnabledThemeInfo... | Themes management screen . |
454 | public function PreviewTheme ( $ ThemeName = '' ) { $ this -> Permission ( 'Garden.Settings.Manage' ) ; $ ThemeInfo = Gdn :: ThemeManager ( ) -> GetThemeInfo ( $ ThemeName ) ; $ PreviewThemeName = $ ThemeName ; $ PreviewThemeFolder = GetValue ( 'Folder' , $ ThemeInfo ) ; if ( $ ThemeInfo === FALSE ) { $ PreviewThemeNam... | Show a preview of a theme . |
455 | public function RemoveAddon ( $ Type , $ Name , $ TransientKey = '' ) { $ RequiredPermission = 'Undefined' ; switch ( $ Type ) { case SettingsModule :: TYPE_APPLICATION : $ Manager = Gdn :: Factory ( 'ApplicationManager' ) ; $ Enabled = 'EnabledApplications' ; $ Remove = 'RemoveApplication' ; $ RequiredPermission = 'Ga... | Remove an addon . |
456 | public function GettingStarted ( ) { $ this -> Permission ( 'Garden.Settings.Manage' ) ; $ this -> SetData ( 'Title' , T ( 'Getting Started' ) ) ; $ this -> AddSideMenu ( 'dashboard/settings/gettingstarted' ) ; $ this -> TextEnterEmails = T ( 'TextEnterEmails' , 'Type email addresses separated by commas here' ) ; if ( ... | Prompts new admins how to get started using new install . |
457 | public function editAction ( ) { $ default = false ; $ params = $ this -> params ( ) ; $ request = $ this -> getRequest ( ) ; $ locator = $ this -> getServiceLocator ( ) ; $ model = $ locator -> get ( 'Grid\Core\Model\SubDomain\Model' ) ; $ form = $ locator -> get ( 'Form' ) -> create ( 'Grid\Core\SubDomain' ) ; if ( (... | Edit a sub - domain |
458 | protected function collectIndexedColumns ( $ indexName , $ columns , & $ collectedIndexes ) { $ indexedColumns = array ( ) ; foreach ( $ columns as $ column ) { $ indexedColumns [ ] = $ column ; $ indexedColumnsHash = $ this -> getColumnList ( $ indexedColumns ) ; if ( ! array_key_exists ( $ indexedColumnsHash , $ coll... | Helper function to collect indexed columns . |
459 | public function addColumn ( $ data ) { if ( $ data instanceof Column ) { $ col = $ data ; $ col -> setTable ( $ this ) ; if ( $ col -> isInheritance ( ) ) { $ this -> inheritanceColumn = $ col ; } if ( isset ( $ this -> columnsByName [ $ col -> getName ( ) ] ) ) { throw new EngineException ( 'Duplicate column declared:... | A utility function to create a new column from attrib and add it to this table . |
460 | private function processArguments ( array $ arguments ) { foreach ( $ arguments as $ argument ) { if ( is_array ( $ argument ) ) { $ this -> processArguments ( $ argument ) ; } elseif ( $ argument instanceof Reference ) { $ this -> graph -> connect ( $ this -> currentId , $ this -> currentDefinition , $ this -> getDefi... | Processes service definitions for arguments to find relationships for the service graph . |
461 | private function getDefinition ( $ id ) { $ id = $ this -> getDefinitionId ( $ id ) ; return null === $ id ? null : $ this -> container -> getDefinition ( $ id ) ; } | Returns a service definition given the full name or an alias . |
462 | protected function doFetch ( array $ ids ) { if ( ! $ ids ) { return [ ] ; } return $ this -> redis -> hmget ( $ this -> namespace , $ this -> keys ( $ ids ) ) ; } | Fetches several cache items . |
463 | protected function doSave ( array $ values , $ lifetime ) { $ this -> redis -> hmset ( $ this -> namespace , $ this -> keys ( $ values ) ) ; return true ; } | Persists several cache items immediately . |
464 | public function loadManifest ( ) { if ( $ this -> files -> exists ( $ this -> manifestPath ) ) { $ manifest = json_decode ( $ this -> files -> get ( $ this -> manifestPath ) , true ) ; return array_merge ( [ 'when' => [ ] ] , $ manifest ) ; } } | Load the service provider manifest JSON file . |
465 | public static function itIsNotConsideredValid ( MapsProperty $ property , $ value ) : Throwable { if ( is_object ( $ value ) ) { return new self ( sprintf ( 'Cannot assign the `%s` to property `%s`: ' . 'The value did not satisfy the specifications.' , get_class ( $ value ) , $ property -> name ( ) ) ) ; } return new s... | Notifies the client code when the input is not accepted by the constraint . |
466 | public function findByPattern ( $ rulePattern ) { $ logger = $ GLOBALS [ 'logger' ] ; $ path = 'rules/' ; $ request = $ this -> _remoteServer -> get ( $ path ) ; $ query = $ request -> getQuery ( ) ; $ query -> set ( 'pattern' , $ rulePattern ) ; $ logger -> info ( print_r ( $ query , 1 ) ) ; try { $ response = $ reque... | Find the rules by pattern |
467 | public function saveRule ( $ rule ) { $ logger = $ GLOBALS [ 'logger' ] ; $ path = 'rules/create' ; $ request = $ this -> _remoteServer -> post ( $ path , array ( 'Content-Type' => 'application/json' ) , $ rule ) ; try { $ response = $ request -> send ( ) ; if ( $ response -> getStatusCode ( ) !== 200 ) { throw new \ E... | Save Rule in Database |
468 | public function updateRule ( $ rule ) { $ logger = $ GLOBALS [ 'logger' ] ; $ path = 'rules/update' ; $ request = $ this -> _remoteServer -> put ( $ path , array ( 'Content-Type' => 'application/json' ) , $ rule ) ; try { $ response = $ request -> send ( ) ; if ( $ response -> getStatusCode ( ) !== 200 ) { throw new \ ... | Update Rule in Database |
469 | public function evaluateRules ( $ ruleData ) { $ logger = $ GLOBALS [ 'logger' ] ; $ path = 'rules/execute' ; $ request = $ this -> _remoteServer -> post ( $ path , array ( 'Content-Type' => 'application/json' ) , $ ruleData ) ; try { $ response = $ request -> send ( ) ; if ( $ response -> getStatusCode ( ) !== 200 ) {... | Evaluate incoming data against available rules . |
470 | public static function parse ( $ range ) { $ matches = array ( ) ; if ( preg_match ( self :: REGEX , $ range , $ matches ) !== 1 ) { throw new InvalidArgumentException ( sprintf ( 'Provided range "%s" does not match Ruby syntax.' , $ range ) ) ; } return new self ( $ matches [ 1 ] + 0 , $ matches [ 3 ] + 0 , $ matches ... | Parses a range in Ruby syntax and returns a Range instance . |
471 | public function doHigh ( $ function_name , $ workload , $ unique = null ) { return parent :: doHigh ( Task :: getName ( $ function_name ) , $ workload , $ unique ) ; } | Runs a single high priority task and returns a string representation of the result . It is up to the GearmanClient and GearmanWorker to agree on the format of the result . High priority tasks will get precedence over normal and low priority tasks in the job queue . |
472 | public function doNormal ( $ function_name , $ workload , $ unique = null ) { return parent :: doNormal ( Task :: getName ( $ function_name ) , $ workload , $ unique ) ; } | Runs a single task and returns a string representation of the result . It is up to the GearmanClient and GearmanWorker to agree on the format of the result . Normal and high priority tasks will get precedence over low priority tasks in the job queue . |
473 | public function doLow ( $ function_name , $ workload , $ unique = null ) { return parent :: doLow ( Task :: getName ( $ function_name ) , $ workload , $ unique ) ; } | Runs a single low priority task and returns a string representation of the result . It is up to the GearmanClient and GearmanWorker to agree on the format of the result . Normal and high priority tasks will get precedence over low priority tasks in the job queue . |
474 | public function doHighBackground ( $ function_name , $ workload , $ unique = null ) { return parent :: doHighBackground ( Task :: getName ( $ function_name ) , $ workload , $ unique ) ; } | Runs a high priority task in the background returning a job handle which can be used to get the status of the running task . High priority tasks take precedence over normal and low priority tasks in the job queue . |
475 | public function doLowBackground ( $ function_name , $ workload , $ unique = null ) { return parent :: doLowBackground ( Task :: getName ( $ function_name ) , $ workload , $ unique ) ; } | Runs a low priority task in the background returning a job handle which can be used to get the status of the running task . Normal and high priority tasks take precedence over low priority tasks in the job queue . |
476 | protected function transformResult ( array $ result ) { if ( $ this -> columnTransformers -> count ( ) ) { foreach ( $ result as $ index => $ row ) { $ result [ $ index ] = $ this -> transformRow ( $ row ) ; } } return $ result ; } | Transforms the results using additional data transformers |
477 | protected function transformRow ( $ row ) { foreach ( $ row as $ field => $ value ) { if ( $ this -> columnTransformers -> has ( $ field ) ) { $ row [ $ field ] = $ this -> columnTransformers -> get ( $ field ) -> transformValue ( $ value ) ; } } return $ row ; } | Processes the row data |
478 | public static function invertBits ( $ n ) { $ bits = \ floor ( \ log ( $ n , 2 ) ) + 1 ; $ mask = ( 1 << $ bits ) - 1 ; return $ n ^ $ mask ; } | Inverts the bits of a number |
479 | public function toDate ( $ date ) { $ this -> current = ( is_string ( $ date ) ? new \ DateTime ( $ date , self :: $ utc ) : $ date ) ; } | Sets the current value! |
480 | public function getModel ( ) { if ( is_null ( $ this -> _model ) ) { $ modelClass = $ this -> modelClass ; $ this -> _model = new $ modelClass ( ) ; } return $ this -> _model ; } | Get model . |
481 | public function formatFilesize ( $ size , $ decimals = 0 , $ binarySuffix = false ) { $ size = ( float ) ceil ( $ size ) ; if ( ! $ size ) { return 0 ; } if ( ! $ binarySuffix ) { $ divisor = 1000 ; $ suffixes = array ( 'Byte' , 'kB' , 'MB' , 'GB' , 'TB' , 'PB' ) ; } else { $ divisor = 1024 ; $ suffixes = array ( 'Byte... | Format a human readable filesize . |
482 | public function addGlobalConfigPath ( string ... $ globalConfigPaths ) : ApplicationBuilder { foreach ( $ globalConfigPaths as $ globalConfigPath ) { $ this -> globalConfigPaths [ ] = $ globalConfigPath ; } return $ this ; } | Add global config path for glob . |
483 | public function addConfig ( LoaderInterface ... $ loaders ) : ApplicationBuilder { foreach ( $ loaders as $ loader ) { $ this -> configs [ ] = $ loader ; } return $ this ; } | Add config loader . |
484 | public function setCacheEnabled ( bool $ cacheEnabled = null ) : ApplicationBuilder { $ this -> cacheEnabled = $ cacheEnabled ?? true ; return $ this ; } | Set cache enabled . |
485 | public function setFrameworkEnabled ( bool $ frameworkEnabled = null ) : ApplicationBuilder { $ this -> frameworkEnabled = $ frameworkEnabled ?? true ; return $ this ; } | Set framework enabled . |
486 | public function addModule ( ModuleInterface ... $ modules ) : ApplicationBuilder { foreach ( $ modules as $ module ) { $ this -> modules [ ] = $ module ; } return $ this ; } | Add module . |
487 | protected function getConfig ( ) : array { $ loader = null ; if ( $ this -> isCacheEnabled ( ) === true ) { $ loader = $ this -> getLoader ( ) ; $ cached = $ loader -> load ( ) ; if ( empty ( $ cached ) === false ) { return $ cached ; } } if ( $ this -> isFrameworkEnabled ( ) === true ) { $ this -> addFrameworkConfigs ... | Get merged global and module config . |
488 | protected function addFrameworkConfigs ( ) : ApplicationBuilder { foreach ( $ this -> getFrameworkConfigs ( ) as $ loader ) { $ loader = new $ loader ; if ( $ loader instanceof LoaderInterface ) { $ this -> addConfig ( $ loader ) ; } } return $ this ; } | Add framework configs . |
489 | protected function getModuleConfig ( ) : array { $ merged = [ ] ; $ merger = $ this -> getMerger ( ) ; foreach ( $ this -> getModules ( ) as $ module ) { if ( $ module instanceof ConditionProviderInterface && $ module -> isConditioned ( ) === true ) { continue ; } if ( $ module instanceof ConfigProviderInterface ) { $ ... | Get config from modules . |
490 | protected function getGlobalConfig ( ) : array { $ loader = new FileLoader ( ) ; foreach ( $ this -> globalConfigPaths as $ path ) { $ loader -> addPath ( $ path ) ; } return $ loader -> load ( ) ; } | Get global config . |
491 | protected function getServiceLocatorFactory ( ) : ServiceLocatorFactoryInterface { if ( ! $ this -> factory instanceof ServiceLocatorFactoryInterface ) { $ this -> factory = new ServiceLocatorFactory ( ) ; } return $ this -> factory ? : new ServiceLocatorFactory ( ) ; } | Get service locator factory . |
492 | protected function getLoader ( ) : LoaderInterface { if ( ! $ this -> loader instanceof LoaderInterface ) { $ this -> loader = new CacheLoader ( sprintf ( '%s/%s.php' , rtrim ( $ this -> getCacheLocation ( ) , '/' ) , $ this -> getCacheFilename ( ) ) ) ; } return $ this -> loader ; } | Get global config loader . |
493 | protected function getMerger ( ) : MergerInterface { if ( ! $ this -> merger instanceof MergerInterface ) { $ this -> merger = new RecursiveMerger ( ) ; } return $ this -> merger ; } | Get config merger . |
494 | protected function reset ( ) : void { $ this -> frameworkEnabled = true ; $ this -> globalConfigPaths = [ ] ; $ this -> cacheLocation = null ; $ this -> cacheFilename = null ; $ this -> cacheEnabled = null ; $ this -> modules = [ ] ; $ this -> configs = [ ] ; $ this -> loader = null ; $ this -> merger = null ; $ this -... | Reset builder . |
495 | public function filterGeneralAttachmentsForObject ( AttachableObjectInterface $ object ) { return $ this -> filterAllAttachmentsForObject ( $ object ) -> useAttachmentLinkQuery ( ) -> filterByModelField ( null , Criteria :: ISNULL ) -> endUse ( ) ; } | Filter attachments for the given object only returning those that are not linked to a specific field name . |
496 | public function filterSpecificAttachmentsForObject ( AttachableObjectInterface $ object , $ fieldName ) { return $ this -> filterAllAttachmentsForObject ( $ object ) -> useAttachmentLinkQuery ( ) -> filterByModelField ( $ fieldName ) -> endUse ( ) ; } | Filter attachments for the given object only returning those that are linked to the given field name |
497 | public function parse ( $ names = null , bool $ isTable = false ) : array { $ ret = [ ] ; if ( $ names === null || $ names == '*' ) { $ ret [ ] = '*' ; } elseif ( \ is_string ( $ names ) ) { $ ret [ ] = $ names ; $ this -> aliases [ ] = $ names . ( $ isTable === true ? '\\.' : '' ) ; } elseif ( \ is_array ( $ names ) )... | Parses names to array of strings . |
498 | public static function forge ( $ presenter , $ method = 'view' , $ auto_filter = null , $ view = null ) { is_null ( $ view ) and $ view = $ presenter ; $ presenter = \ Inflector :: words_to_upper ( str_replace ( array ( '/' , DS ) , '_' , strpos ( $ presenter , '.' ) === false ? $ presenter : substr ( $ presenter , 0 ,... | Factory for fetching the Presenter |
499 | public function & get ( $ key = null , $ default = null ) { if ( is_null ( $ default ) and func_num_args ( ) === 1 ) { return $ this -> _view -> get ( $ key ) ; } return $ this -> _view -> get ( $ key , $ default ) ; } | Gets a variable from the template |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.