idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
27,000 | public static function propertyBatchLoadCallback ( $ page_counter , $ per_page , $ search_instance_id , $ modify_replace , & $ context ) { $ nt8restService = \ Drupal :: service ( 'nt8tabsio.tabs_service' ) ; $ nt8PropertyMethods = \ Drupal :: service ( 'nt8property.property_methods' ) ; $ pages = $ per_page [ 'pages' ] ; $ pageSize = $ per_page [ 'per_page' ] ; $ data = json_decode ( $ nt8restService -> get ( "property" , [ "page" => $ page_counter + 1 , "pageSize" => $ pageSize , "searchId" => $ search_instance_id , ] ) ) ; $ results = $ data -> results ; if ( ! isset ( $ context [ 'results' ] [ 'count_processed' ] ) ) { $ context [ 'results' ] [ 'count_processed' ] = 0 ; } if ( ! isset ( $ context [ 'results' ] [ 'nodes_updated' ] ) ) { $ context [ 'results' ] [ 'nodes_updated' ] = [ ] ; } foreach ( $ results as $ result ) { $ context [ 'results' ] [ 'count_processed' ] ++ ; switch ( $ modify_replace ) { case 0 : $ nodes_updated = $ nt8PropertyMethods -> updateNodeInstancesFromData ( $ result ) ; $ context [ 'results' ] [ 'nodes_updated' ] = array_merge ( $ context [ 'results' ] [ 'nodes_updated' ] , $ nodes_updated ) ; break ; default : $ nt8PropertyMethods -> createNodeInstanceFromData ( $ result , TRUE ) ; } } } | Callback function for drupal property batch load progress . |
27,001 | public static function propertyBatchLoadFinishedCallback ( $ success , $ results , $ operations ) { $ updated_node_ids = implode ( ', ' , $ results [ 'nodes_updated' ] ) ; $ processed = $ results [ 'count_processed' ] ; drupal_set_message ( "Processed $processed nodes. And updated these: [$updated_node_ids] nodes." ) ; } | Callback which is fired once the Drupal batch job has finished . |
27,002 | public static function fromString ( $ response ) { $ code = self :: extractCode ( $ response ) ; $ headers = self :: extractHeaders ( $ response ) ; $ body = self :: extractBody ( $ response ) ; $ version = self :: extractVersion ( $ response ) ; $ message = self :: extractMessage ( $ response ) ; if ( $ code === 100 && count ( $ headers ) === 0 && self :: extractCode ( $ body ) ) { return self :: fromString ( $ body ) ; } return new static ( $ code , $ headers , $ body , $ version , $ message ) ; } | Create a new Response object from a string |
27,003 | public function setColor ( $ level , $ foreground_color = 'white' , $ background_color = null ) { if ( array_key_exists ( $ level , $ this -> levels ) ) { $ this -> levels [ $ level ] [ 0 ] = $ foreground_color ; $ this -> levels [ $ level ] [ 1 ] = $ background_color ; } return $ this ; } | Sets the colors for a level |
27,004 | public function getJWT ( ) { if ( $ this -> personalKeyPair === NULL ) throw new \ Exception ( "JWT cannot be built without the personalKey" ) ; $ signer = new Sha512 ( ) ; $ personalPrivateKey = PrivateKey :: formatPEM ( $ this -> personalKeyPair -> getPrivateKey ( ) ) ; $ token = ( new Builder ( ) ) -> set ( 'socialRecord' , base64_encode ( $ this -> socialRecord -> getJSONString ( ) ) ) -> sign ( $ signer , $ personalPrivateKey ) -> getToken ( ) ; return $ token -> __toString ( ) ; } | Creates a signed JWT to be pushed to the GSLS . If the personalKeyPair is not set an exception is thrown |
27,005 | public function redirect ( ) { if ( headers_sent ( ) === false ) { header ( 'X-PHP-Response-Code: 403' , true , 403 ) ; } if ( isset ( $ _GET [ 'template' ] ) === false ) { return redirect ( $ this -> router -> generate ( 'login-page' ) ) ; } else { return 'Redirect: ' . $ this -> router -> generate ( 'login-page' ) ; } } | Redirect to the login page |
27,006 | public function logout ( ) { $ this -> core -> auth ( ) -> invalidate ( ) ; $ this -> router -> map ( 'GET' , '/login' , "Auth@showLogin" , 'login-page' ) ; return $ this -> redirect ( ) ; } | Logout active page |
27,007 | public function getCardOwner ( ) : ? string { if ( ! $ this -> hasCardOwner ( ) ) { $ this -> setCardOwner ( $ this -> getDefaultCardOwner ( ) ) ; } return $ this -> cardOwner ; } | Get card owner |
27,008 | public function prependAdapter ( AdapterInterface $ adapter ) { $ priority = self :: DEFAULT_PRIORITY ; if ( ! $ this -> adapters -> isEmpty ( ) ) { $ extractedNodes = $ this -> adapters -> toArray ( PriorityQueue :: EXTR_PRIORITY ) ; rsort ( $ extractedNodes , SORT_NUMERIC ) ; $ priority = $ extractedNodes [ 0 ] + 1 ; } $ this -> adapters -> insert ( $ adapter , $ priority ) ; return $ this ; } | Adds a adapter to the beginning of the chain . |
27,009 | public function merge ( AdapterChain $ adaptersChain ) { $ adapters = $ adaptersChain -> adapters -> toArray ( PriorityQueue :: EXTR_BOTH ) ; foreach ( $ adapters as $ item ) { $ this -> attach ( $ item [ 'data' ] , $ item [ 'priority' ] ) ; } return $ this ; } | Merge the adapter chain with the one given in parameter . |
27,010 | public function attach ( AdapterInterface $ adapter , $ priority = self :: DEFAULT_PRIORITY ) { $ this -> adapters -> insert ( $ adapter , $ priority ) ; return $ this ; } | Attach a adapter to the end of the chain . |
27,011 | public function getMessages ( ) { $ results = $ this -> getResults ( ) ; $ messages = [ ] ; foreach ( $ results as $ result ) { $ messages = array_replace_recursive ( $ messages , $ result -> getMessages ( ) ) ; } return $ messages ; } | Returns array of validation failure messages . |
27,012 | public static function low ( string $ data , int $ offset = 0 , $ nibble = null ) : string { return unpack ( $ nibble ? "h{$nibble}" : 'h' , $ data , $ offset ) [ 1 ] ; } | Read a hex string with low nibble first . |
27,013 | public static function high ( string $ data , int $ offset = 0 , $ nibble = null ) : string { return unpack ( $ nibble ? "H{$nibble}" : 'H' , $ data , $ offset ) [ 1 ] ; } | Read a hex string with high nibble first . |
27,014 | public function fromUser ( $ user_id ) { $ sites = $ this -> User -> find ( 'first' , array ( 'conditions' => array ( 'User.id' => $ user_id ) , 'contain' => array ( 'Site' , ) ) ) ; if ( ! empty ( $ sites [ 'Site' ] ) ) { return $ sites [ 'Site' ] ; } else { return null ; } } | Me devuelve todos los sitios del usuario |
27,015 | public function buscarUsersComercio ( ) { $ currentSiteAlias = MtSites :: getSiteName ( ) ; $ site = $ this -> find ( 'first' , array ( 'contain' => array ( 'User' => array ( 'conditions' => array ( 'is_admin' => 0 ) ) ) , 'conditions' => array ( 'Site.alias' => $ currentSiteAlias ) , ) ) ; $ users = $ site [ 'User' ] ; return $ users ; } | Busca todos los usuarios del comercio |
27,016 | protected function cmdListStores ( ) { $ container = Dependency :: container ( ) ; $ match = '' ; if ( ! empty ( $ this -> command -> arguments [ 'match' ] ) && ( $ match = trim ( $ this -> command -> arguments [ 'match' ] ) ) !== '' && ! preg_match ( '/^\/.+\/[a-zA-Z]*$/' , $ match ) ) { $ this -> command -> inputErrors [ ] = '\'match\' argument must be slash delimited regular expression.' ; } $ get = ! empty ( $ this -> command -> options [ 'get' ] ) ; if ( $ this -> command -> inputErrors ) { foreach ( $ this -> command -> inputErrors as $ msg ) { $ this -> environment -> echoMessage ( $ this -> environment -> format ( $ msg , 'hangingIndent' ) , 'notice' ) ; } $ this -> environment -> echoMessage ( "\n" . $ this -> command ) ; exit ; } if ( $ container -> has ( 'cache-broker' ) ) { $ cache_broker_class = get_class ( $ container -> get ( 'cache-broker' ) ) ; } else { $ cache_broker_class = static :: CLASS_CACHE_BROKER ; } $ cache_class = constant ( $ cache_broker_class . '::CACHE_CLASSES' ) [ CacheBroker :: CACHE_BASE ] ; if ( ! method_exists ( $ cache_class , 'listInstances' ) ) { $ this -> environment -> echoMessage ( 'Cannot retrieve list of cache store instances via class[' . $ cache_class . '], has no static method listInstances().' , 'error' ) ; exit ; } $ stores = forward_static_call ( $ cache_class . '::listInstances' ) ; $ names = [ ] ; foreach ( $ stores as $ instance ) { if ( preg_match ( '/^config\..+/' , $ instance -> name ) ) { $ name = substr ( $ instance -> name , 7 ) ; if ( ! $ match || preg_match ( $ match , $ name ) ) { $ names [ ] = $ name ; } } } sort ( $ names ) ; if ( $ get ) { return join ( ',' , $ names ) ; } $ this -> environment -> echoMessage ( join ( "\n" , $ names ) ) ; exit ; } | List all config stores . |
27,017 | public function addField ( Field $ field ) { if ( array_search ( $ field , $ this -> fields ) === false ) $ this -> fields [ ] = $ field ; } | Adds the field to the MetaBox if not present |
27,018 | public function removeField ( Field $ field ) { if ( ( $ index = array_search ( $ field , $ this -> fields ) ) !== false ) array_splice ( $ this -> fields , $ index , 1 ) ; } | Removes the field from the MetaBox if present |
27,019 | public static function run ( $ type = 'web' , $ session = true ) { $ lumos = $ type == 'lumos' ? true : false ; static :: init ( $ type ) ; static :: support ( ) ; static :: version ( ) ; static :: logging ( ) ; static :: input ( ) ; if ( $ type == 'test' ) { static :: mock ( ) ; } static :: config ( $ type == 'test' ? true : false ) ; static :: environment ( ) ; static :: maintenance ( $ lumos ) ; static :: time ( ) ; static :: initLogging ( ) ; static :: component ( ) ; static :: cubes ( ) ; static :: collections ( ) ; static :: storage ( $ session ) ; static :: string ( ) ; static :: access ( ) ; static :: validation ( ) ; if ( Component :: isOn ( 'faker' ) ) { static :: faker ( ) ; } static :: cookie ( ) ; static :: router ( ) ; static :: caches ( ) ; static :: security ( ) ; static :: auth ( ) ; if ( Component :: isOn ( 'database' ) ) { static :: database ( ) ; } static :: http ( ) ; static :: assets ( ) ; static :: html ( ) ; static :: Hypertext ( ) ; static :: translator ( ) ; static :: model ( ) ; static :: relations ( ) ; static :: media ( ) ; static :: view ( ) ; static :: controller ( ) ; static :: mail ( ) ; static :: dataCollection ( ) ; static :: file ( ) ; static :: intro ( ) ; static :: plugins ( ) ; static :: lumos ( ) ; static :: atomium ( ) ; static :: proccess ( ) ; static :: setup ( ) ; static :: event ( ) ; static :: test ( ) ; } | Run the Bus surface . |
27,020 | private static function call ( array $ files , $ folder , $ ext = 'php' ) { foreach ( $ files as $ file ) { static :: need ( $ folder . $ file . '.' . $ ext ) ; } } | Call files of a folder . |
27,021 | public static function fetch ( $ pattern , $ app = false ) { if ( $ app ) { $ path = root ( ) . 'app/' . $ pattern . '/*.php' ; } else { $ path = root ( ) . $ pattern . '/*.php' ; } return glob ( $ path ) ; } | Fetch files from folder . |
27,022 | private static function input ( ) { $ files = [ 'Input' ] ; $ folder = static :: $ root . 'Http' . '/' ; self :: call ( $ files , $ folder ) ; Input :: register ( ) ; } | Call and init Input surface . |
27,023 | private static function config ( $ test = false ) { $ files = [ 'Config' , 'Alias' ] ; $ folder = static :: $ root . 'Config' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'ConfigException' , 'DatabaseDriverNotFoundException' , 'AliasedClassNotFoundException' ] ; $ folder = static :: $ root . 'Config/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; Config :: load ( ) ; } | Call Config surface and initiate it . |
27,024 | private static function maintenance ( $ lumos ) { $ files = [ 'Maintenance' ] ; $ folder = static :: $ root . 'Maintenance' . '/' ; self :: call ( $ files , $ folder ) ; if ( ! $ lumos ) { Maintenance :: launch ( ) ; } } | Call the Maintenance surface . |
27,025 | private static function time ( ) { $ files = [ 'DateTime' ] ; $ folder = static :: $ root . 'Time' . '/' ; self :: call ( $ files , $ folder ) ; DateTime :: setTimezone ( ) ; } | Call Time surface . |
27,026 | private static function component ( ) { $ files = [ 'Component' ] ; $ folder = static :: $ root . 'Foundation' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'SurfaceDisabledException' ] ; $ folder = static :: $ root . 'Foundation/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call Component surface . |
27,027 | private static function session ( $ session ) { $ files = [ 'Session' ] ; $ folder = static :: $ root . 'Storage' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'SessionKeyNotFoundException' , 'SessionSurfaceIsOffException' ] ; $ folder = static :: $ root . 'Storage/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; if ( $ session ) { Session :: ini ( ) ; } } | Call Session class . |
27,028 | private static function storage ( $ session ) { static :: session ( $ session ) ; $ files = [ 'Storage' ] ; $ folder = static :: $ root . 'Storage' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'NotFoundStorageDiskException' ] ; $ folder = static :: $ root . 'Storage/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the Storage surface . |
27,029 | private static function string ( ) { $ files = [ 'Strings' ] ; $ folder = static :: $ root . 'Strings' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'StringOutIndexException' ] ; $ folder = static :: $ root . 'Strings/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the String surface . |
27,030 | private static function validation ( ) { $ files = [ 'Validator' , 'ValidationResult' ] ; $ folder = static :: $ root . 'Validation' . '/' ; self :: call ( $ files , $ folder ) ; Validator :: ini ( ) ; } | Call the Validation surface . |
27,031 | private static function router ( ) { $ files = [ 'Url' ] ; $ folder = static :: $ root . 'Router' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'Route' , 'Routes' ] ; $ folder = static :: $ root . 'Http/Router' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'RouteDuplicatedException' , 'RouteMiddlewareNotFoundException' , 'RouteNotFoundInRoutesRegisterException' , 'NotFoundHttpException' ] ; $ folder = static :: $ root . 'Http/Router/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call Router surface . |
27,032 | private static function caches ( ) { $ files = [ 'Driver' , 'FileDriver' , 'ArrayDriver' , 'PhpFilesDriver' , 'ApcDriver' , 'PDODriver' ] ; $ folder = static :: $ root . 'Caches/Drivers' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'Item' , 'Cache' ] ; $ folder = static :: $ root . 'Caches' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'CacheItemNotFoundException' , 'DriverNotFoundException' , 'DatabaseSurfaceDisabledException' ] ; $ folder = static :: $ root . 'Caches/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call Caches surface . |
27,033 | private static function auth ( ) { $ files = [ 'Auth' ] ; $ folder = static :: $ root . 'Authentication' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'AuthenticationModelNotFoundException' ] ; $ folder = static :: $ root . 'Authentication/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call Auth surface . |
27,034 | public static function database ( ) { $ path = static :: $ root . 'Database/' ; $ files = [ 'Driver' , 'MysqlDriver' ] ; $ folder = $ path . 'Drivers' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'Exporter' , 'Importer' ] ; $ folder = $ path . 'InOut/Mysql/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'MysqlConnector' ] ; $ folder = $ path . 'Connectors' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'ConnectorException' , 'QueryException' , 'SeedersEmptyException' , 'DatabaseArgumentsException' , 'DatabaseConnectionException' , 'SchemaTableExistsException' , 'SchemaTableNotExistException' ] ; $ folder = $ path . 'Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'Schema' , 'MysqlSchema' ] ; $ folder = $ path . 'Schemas' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'Migration' , 'Seeder' , 'DBTable' , 'Query' , 'Row' , 'Database' ] ; $ folder = $ path ; self :: call ( $ files , $ folder ) ; } | Call Database surface . |
27,035 | private static function http ( ) { $ files = [ 'Http' , 'Request' ] ; $ folder = static :: $ root . 'Http' . '/' ; self :: call ( $ files , $ folder ) ; static :: links ( ) ; static :: redirect ( ) ; static :: middleware ( ) ; } | Call HTTP surface . |
27,036 | private static function links ( ) { $ files = [ 'Link' ] ; $ folder = static :: $ root . 'Http/Links' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'LinkKeyNotFoundException' ] ; $ folder = static :: $ root . 'Http/Links/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the Links surface . |
27,037 | private static function middleware ( ) { $ files = [ 'Filters' , 'Middleware' ] ; $ folder = static :: $ root . 'Http/Middleware' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'MiddlewareNotFoundException' , 'MiddlewareWallException' ] ; $ folder = static :: $ root . 'Http/Middleware/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the Middleware surface . |
27,038 | private static function translator ( ) { $ files = [ 'Lang' , 'Smiley' ] ; $ folder = static :: $ root . 'Translator' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'LanguageKeyNotFoundException' , 'LanguageNotSupportedException' ] ; $ folder = static :: $ root . 'Translator/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the Translator surface . |
27,039 | private static function model ( ) { $ files = [ 'ORM_' , 'CRUD' , 'ORM' , 'Collection' , 'ModelArray' ] ; $ folder = static :: $ root . 'MVC/Model' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'ForeingKeyMethodException' , 'ColumnNotEmptyException' , 'ManyPrimaryKeysException' , 'TableNotFoundException' , 'ModelNotFoundException' , 'PrimaryKeyNotFoundException' ] ; $ folder = static :: $ root . 'MVC/Model/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the Model surface . |
27,040 | private static function relations ( ) { $ files = [ 'OneToOne' , 'OneToMany' , 'ManyToMany' , 'BelongsTo' ] ; $ folder = static :: $ root . 'MVC/Relations' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'ManyRelationException' , 'ModelNotFindedException' ] ; $ folder = static :: $ root . 'MVC/Relations/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the Realtons surface . |
27,041 | private static function view ( ) { $ files = [ 'View' ] ; $ folder = static :: $ root . 'MVC/View' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'Template' , 'Views' ] ; $ folder = static :: $ root . 'MVC/View/Libs' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'ViewNotFoundException' ] ; $ folder = static :: $ root . 'MVC/View/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the View surface . |
27,042 | private static function mail ( ) { $ files = [ 'Mail' , 'Mailable' , 'SMTP' ] ; $ folder = static :: $ root . 'Mailing' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'SmtpParameterNotFoundException' , 'MailViewNotFoundException' ] ; $ folder = $ folder . 'Exceptions/' ; self :: call ( $ files , $ folder ) ; } | Call the Mail surface . |
27,043 | private static function file ( ) { $ files = [ 'File' , 'Filesystem' ] ; $ folder = static :: $ root . 'Filesystem' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'FileNotFoundException' , 'DirectoryNotFoundException' ] ; $ folder = static :: $ root . 'Filesystem/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the Files surface . |
27,044 | private static function plugins ( ) { $ files = [ 'Plugins' ] ; $ folder = static :: $ root . 'Plugins' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'AutoloadFileNotFoundException' , 'InfoStructureException' ] ; $ folder = static :: $ root . 'Plugins/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the Plugins surface . |
27,045 | private static function lumos ( ) { $ files = [ 'cmdOutput' , 'bashOutput' , 'Argument' , 'Option' , 'Commands' ] ; $ folder = static :: $ root . 'Lumos' . '/' ; self :: call ( $ files , $ folder ) ; static :: commands ( ) ; $ files = [ 'Console' ] ; $ folder = static :: $ root . 'Lumos' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'ConfigSetting' ] ; $ folder = static :: $ root . 'Lumos/Response' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the Lumos surface . |
27,046 | private static function atomium ( ) { $ path = static :: $ root . 'Atomium/' ; $ files = [ 'Atomium' , 'Compiler' ] ; $ folder = $ path ; self :: call ( $ files , $ folder ) ; $ files = [ 'AtomiumUserTags' , 'AtomiumCompileCSS' , 'AtomiumCompileJS' , 'AtomiumCompileAssign' , 'AtomiumCompileRun' , 'AtomiumCompileComments' , 'AtomiumCompileComment' , 'AtomiumCompileInstruction' , 'AtomiumCompileInstructions' , 'AtomiumCompileIf' , 'AtomiumCompileFor' , 'AtomiumCompileEndFor' , 'AtomiumCompileBreak' , 'AtomiumCompileOneLineComment' , 'AtomiumCompileElse' , 'AtomiumCompileEndIf' , 'AtomiumCompileElseIf' , 'AtomiumCompileForeach' , 'AtomiumCompileEndForeach' , 'AtomiumCompileWhile' , 'AtomiumCompileEndWhile' , 'AtomiumCompileUntil' , 'AtomiumCompileEndUntil' , 'AtomiumCompileSub' , 'AtomiumCompileExec' , 'AtomiumCompileLang' , 'AtomiumCompileTake' , 'AtomiumCompileCapture' , ] ; $ folder = $ path . 'Compiler' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'AromiumCaptureNotFoundException' ] ; $ folder = $ path . 'Exception/' ; self :: call ( $ files , $ folder ) ; Compiler :: setUserTags ( ) ; } | Call the Atomium surface . |
27,047 | private static function proccess ( ) { $ files = [ 'Process' , 'Command' , 'Translator' , 'Migrations' , 'Links' , 'Tag' , 'Model' , 'View' , 'Controller' , 'Seeds' , 'Router' , 'Exception' , 'Events' , 'Alias' , 'Middleware' , 'Helper' , 'Tests' , 'Mail' , 'Query' ] ; $ folder = static :: $ root . 'Processes' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'TranslatorFolderNeededException' , 'TranslatorManyFolderException' ] ; $ folder = static :: $ root . 'Processes/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the Process surface . |
27,048 | private static function setup ( ) { $ files = [ 'Routes' , 'Setup' , 'Response' ] ; $ folder = static :: $ root . 'Setup' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'Database' , 'Panel' , 'Security' , 'Maintenance' , 'Loggin' , 'Translator' , 'App' , 'Robots' ] ; $ folder = static :: $ root . 'Setup/Documentations' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'AppSetupException' ] ; $ folder = static :: $ root . 'Setup/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the Setup surface . |
27,049 | private static function event ( ) { $ files = [ 'Event' , 'EventListener' ] ; $ folder = static :: $ root . 'Event' . '/' ; self :: call ( $ files , $ folder ) ; $ files = [ 'ManyListenersArgumentsException' ] ; $ folder = static :: $ root . 'Event/Exceptions' . '/' ; self :: call ( $ files , $ folder ) ; } | Call the Event surface . |
27,050 | public function meet ( array $ nodeUrls ) { $ current = $ this -> stream -> getNodeUrl ( ) ; return array_filter ( $ nodeUrls , function ( $ url ) use ( $ current ) { if ( $ url === $ current ) { return true ; } $ parts = parse_url ( $ url ) ; try { $ response = $ this -> send ( [ 'CLUSTER' , 'MEET' , $ parts [ 'host' ] , ( int ) $ parts [ 'port' ] ] ) ; $ this -> log -> debug ( 'CLUSTER MEET' , [ 'host' => $ url , 'response' => $ response ] ) ; return 'OK' === $ response ; } catch ( Exception $ e ) { $ this -> log -> error ( $ e -> getMessage ( ) , array ( 'url' => $ url , 'exception' => $ e ) ) ; return false ; } } ) ; } | Introduce the provided nodes to the connected Disque instance . |
27,051 | public function save ( EntityInterface $ entity , $ options = [ ] ) { EventManager :: trigger ( 'Model.User.beforeSave' , $ this , [ 'user' => $ entity ] ) ; $ success = parent :: save ( $ entity , $ options ) ; EventManager :: trigger ( 'Model.User.afterSave' , $ this , [ 'user' => $ entity , 'success' => $ success ] ) ; return $ success ; } | Persists an entity based on the fields that are marked as dirty and returns the same entity after a successful save or false in case of any error . |
27,052 | private function makeTree ( array $ result ) { $ tree = [ ] ; foreach ( $ result as $ row ) { $ this -> makeNode ( $ row , $ tree ) ; } return $ tree ; } | Creates flat tree structure from result rows |
27,053 | private function makeNode ( & $ row , & $ tree ) { $ hasChildren = $ this -> propertyAccessor -> getValue ( $ row , "[{$this->options['children_column']}]" ) ; $ weight = $ this -> propertyAccessor -> getValue ( $ row , "[{$this->options['hierarchy_column']}]" ) ; $ row [ 'hasChildren' ] = ( bool ) ( $ hasChildren > 0 ) ; $ row [ 'weight' ] = $ weight ; $ tree [ $ row [ 'id' ] ] = $ row ; } | Converts single row to flat - tree node |
27,054 | public function getEntityManager ( ) { if ( ! isset ( $ this -> _entityManager ) ) { $ this -> _entityManager = $ this -> getServiceLocator ( ) -> get ( 'Doctrine\ORM\EntityManager' ) ; } return $ this -> _entityManager ; } | Get entity manager |
27,055 | public function collection ( array $ ids , array $ options = array ( ) ) { $ photos = $ this -> dataStore -> getPhotos ( $ ids ) ; if ( empty ( $ photos ) && ! $ this -> storageManager -> hasFallback ( ) ) { return $ this -> createPhotoCollection ( ) ; } $ found = array ( ) ; array_map ( function ( $ photo ) use ( $ ids , & $ found ) { return $ found [ $ photo [ 'id' ] ] = $ photo ; } , $ photos ) ; $ sorted = array ( ) ; foreach ( $ ids as $ index => $ id ) { $ photo = array ( ) ; if ( array_key_exists ( $ id , $ found ) ) { $ photo = $ found [ $ id ] ; } $ sorted [ $ index ] = $ photo ; } $ photos = $ this -> createPhotoCollection ( $ sorted ) ; $ simplePhoto = $ this ; $ photos -> transform ( function ( $ photo ) use ( $ simplePhoto , $ options ) { return $ simplePhoto -> build ( $ photo , $ options ) ; } ) -> ksort ( ) ; return $ photos ; } | Gets multiple photos |
27,056 | public static function dial ( $ addr ) { $ socket = stream_socket_client ( 'tcp://' . $ addr ) ; if ( $ socket === false ) { throw new Exception ( 'Could not dial to ' . $ addr . ': ' . socket_strerror ( socket_last_error ( ) ) ) ; } return $ socket ; } | Connect to a TCP address and return a stream resource |
27,057 | public function markChanged ( ) : void { $ this -> changed = true ; $ this -> xliff -> setDate ( new \ DateTime ( ) ) ; if ( ! $ this -> buffering ) { $ this -> xliff -> save ( $ this -> filename ) ; } } | Mark the file as changed . |
27,058 | public function setOriginal ( string $ source ) : void { $ this -> xliff -> setOriginal ( $ source ) ; $ this -> markChanged ( ) ; } | Set the original . |
27,059 | public function populate ( $ model , $ children ) { $ allChildren = ( $ children === true ) ? true : false ; $ children = ( is_array ( $ children ) ) ? $ children : [ ] ; foreach ( $ this -> getReferenceMap ( ) as $ name => $ options ) { if ( $ allChildren || in_array ( $ name , $ children ) ) { $ service = $ this -> getRelatedService ( $ name ) ; $ getIdMethod = 'get' . ucfirst ( $ options [ 'refCol' ] ) ; $ setMethod = $ options [ 'setMethod' ] ?? 'set' . ucfirst ( $ name ) ; $ getMethod = $ options [ 'getMethod' ] ?? 'getById' ; $ childModel = $ service -> $ getMethod ( $ model -> $ getIdMethod ( ) , $ options [ 'refCol' ] ) ; if ( $ childModel instanceof HydratingResultSet ) { $ childModelObjects = [ ] ; foreach ( $ childModel as $ row ) { $ childModelObjects [ ] = $ row ; } $ childModel = $ childModelObjects ; } $ model -> $ setMethod ( $ childModel ) ; } } return $ model ; } | populate relational records . |
27,060 | public function encodeMessage ( $ message , $ queue ) { $ messageFactory = $ this -> getMessageFactory ( ) ; if ( ! $ this -> messageFactory -> accepts ( $ message ) ) { throw new Exception \ RuntimeException ( sprintf ( '%s does not accept message of type "%s"' , get_class ( $ messageFactory ) , ( is_object ( $ message ) ? get_class ( $ message ) : gettype ( $ message ) ) ) ) ; } return new BernardDefaultMessage ( $ queue , array ( self :: MESSAGE_CLASS_KEY => get_class ( $ message ) , self :: MESSAGE_KEY => $ this -> getMessageFactory ( ) -> toArray ( $ message ) , ) ) ; } | Encode message for Bernard . |
27,061 | public function decodeMessage ( BernardMessage $ message ) { if ( ! isset ( $ message -> { self :: MESSAGE_CLASS_KEY } ) ) { throw new Exception \ RuntimeException ( sprintf ( 'Message is missing key "%s"' , self :: MESSAGE_CLASS_KEY ) ) ; } if ( ! is_string ( $ message -> { self :: MESSAGE_CLASS_KEY } ) ) { throw new Exception \ RuntimeException ( sprintf ( 'Message has invalid value for key "%s"; must be a string' , self :: MESSAGE_CLASS_KEY ) ) ; } if ( ! isset ( $ message -> { self :: MESSAGE_KEY } ) ) { throw new Exception \ RuntimeException ( sprintf ( 'Message is missing key "%s"' , self :: MESSAGE_KEY ) ) ; } if ( ! is_array ( $ message -> { self :: MESSAGE_KEY } ) ) { throw new Exception \ RuntimeException ( sprintf ( 'Message has invalid value for key "%s"; must be an array' , self :: MESSAGE_KEY ) ) ; } return $ this -> getMessageFactory ( ) -> createFromArray ( $ message -> { self :: MESSAGE_KEY } , $ message -> { self :: MESSAGE_CLASS_KEY } ) ; } | Decode message from Bernard . |
27,062 | public function param ( $ key = NULL , $ default = NULL ) { $ params = $ this -> app -> router -> getCurrentRoute ( ) -> getParams ( ) ; return ( array_key_exists ( $ key , $ params ) ) ? $ params [ $ key ] : $ default ; } | Gets route params |
27,063 | public static function create ( $ files , $ path , $ quality = 0 ) { switch ( self :: getFileExtension ( $ path ) ) { case 'png' : if ( $ quality > 10 ) { $ quality = ( int ) ( $ quality / 10 ) ; } return imagepng ( $ files , $ path , $ quality ? : 8 ) ; case 'gif' : return imagegif ( $ files , $ path ) ; case 'jpg' : case 'jpeg' : default : return imagejpeg ( $ files , $ path , $ quality ? : 80 ) ; } } | Image type creator |
27,064 | public static function from ( $ path ) { switch ( self :: getFileExtension ( $ path ) ) { case 'png' : return imagecreatefrompng ( $ path ) ; case 'gif' : return imagecreatefromgif ( $ path ) ; case 'jpg' : case 'jpeg' : default : return imagecreatefromjpeg ( $ path ) ; } } | Image create from |
27,065 | private function postProcessing ( JsonResponse $ response ) { $ apiUrl = $ this -> getServiceContainer ( ) -> getPreferenceLoader ( ) -> getSystemPreferences ( ) -> getApiUrl ( ) ; $ response -> setContent ( str_replace ( '%apiurl%' , $ apiUrl , $ response -> getContent ( ) ) ) ; return $ response ; } | Some post processing on the generated result . Replacing some variables . |
27,066 | public function setConnections ( $ connections , $ defaultConnection = null ) { if ( ! is_array ( $ connections ) ) { throw new ConfigException ( "Connections must be an array" ) ; } if ( $ defaultConnection ) { $ this -> setDefaultConnection ( $ defaultConnection ) ; } $ this -> _connections = $ connections ; } | Sets the list of database connection strings . |
27,067 | public function getConnection ( $ name ) { if ( array_key_exists ( $ name , $ this -> _connections ) ) return $ this -> _connections [ $ name ] ; return null ; } | Returns a connection string if found otherwise null . |
27,068 | public function getDefaultConnectionString ( ) { return array_key_exists ( $ this -> _defaultConnection , $ this -> _connections ) ? $ this -> _connections [ $ this -> _defaultConnection ] : null ; } | Returns the default connection string or null if there is none . |
27,069 | public function getModelDirectory ( ) { if ( $ this -> _modelDirectory && ! file_exists ( $ this -> _modelDirectory ) ) throw new ConfigException ( 'Invalid or non-existent directory: ' . $ this -> _modelDirectory ) ; return $ this -> _modelDirectory ; } | Returns the model directory . |
27,070 | public function add_menu ( ) { if ( ! isset ( $ this -> page_id ) && ! isset ( $ this -> title ) && ! isset ( $ this -> name ) && ! isset ( $ this -> parent ) && ! isset ( $ this -> cap ) ) { return ; } if ( $ this -> parent ) { $ this -> screen_name = add_submenu_page ( $ this -> parent , $ this -> title , $ this -> name , $ this -> cap , $ this -> page_id , array ( & $ this , 'render_page' ) ) ; } else { $ this -> screen_name = add_menu_page ( $ this -> title , $ this -> name , $ this -> cap , $ this -> page_id , array ( & $ this , 'render_page' ) ) ; } } | Add the Admin PAge to the WordPress Menu |
27,071 | public function validate_screen ( ) { $ screen = get_current_screen ( ) ; if ( $ screen -> id === $ this -> screen_name ) { add_action ( 'admin_print_scripts' , array ( & $ this , 'load_scripts' ) ) ; add_action ( 'admin_print_styles' , array ( & $ this , 'load_styles' ) ) ; add_filter ( 'contextual_help' , array ( & $ this , 'contextual_help' ) ) ; require_once ( WPBP_DIR . '/app/models/admin/' . $ this -> page_id . '.php' ) ; require_once ( WPBP_DIR . '/app/views/admin/' . $ this -> page_id . '.php' ) ; $ this -> model = new $ this -> model ( ) ; $ this -> view = new $ this -> view ( $ this -> model -> get_data ( ) ) ; $ this -> view -> controller = $ this ; $ this -> process_get ( ) ; $ this -> process_post ( ) ; $ this -> init ( ) ; } } | Verify that we are on the correct screen |
27,072 | public function merge ( array $ data ) { if ( array_key_exists ( '_id' , $ data ) ) { throw new \ Exception ( 'Property "_id" is read-only' ) ; } else { $ this -> import ( $ data ) ; parent :: merge ( $ data ) ; } } | Merge specified data into dataobject . Note that the method will throw an exception if the data to merge contains a new object ID . |
27,073 | public function save ( $ new_key = null ) { $ return = true ; $ cn = $ this -> device -> getConnection ( \ Octris \ Db :: DB_MASTER ) ; $ cl = $ cn -> getCollection ( $ this -> collection ) ; if ( is_null ( $ this -> _id ) || ( ! is_null ( $ new_key ) && $ this -> _id !== $ new_key ) ) { if ( ( $ return = ! ! ( $ new_key = $ cl -> insert ( $ this , $ new_key ) ) ) ) { $ this -> _id = $ new_key ; } } else { $ return = $ cl -> update ( $ this , $ this -> _id ) ; } $ cn -> release ( ) ; return $ return ; } | Save dataobject to bucket . |
27,074 | protected function export ( array & $ data ) { array_walk_recursive ( $ data , function ( & $ value , $ name ) { $ value = $ this -> castPhpToDb ( $ value , $ name ) ; } ) ; } | Recursive data iteration and casting for preparing data for export to database . |
27,075 | protected function import ( array & $ data ) { array_walk_recursive ( $ data , function ( & $ value , $ name ) { $ value = $ this -> castDbToPhp ( $ value , $ name ) ; } ) ; } | Recursive data iteration and casting for preparing data for import into dataobject . |
27,076 | protected function setConfig ( Config $ config , ConfigSchema $ schema = null ) { if ( $ schema ) { $ schema -> validate ( $ config ) ; } $ config -> validate ( ) ; $ this -> config = $ config ; } | Validates and sets the configuration object . |
27,077 | public function getTemplateContent ( $ template , array $ variables ) { $ dir = dirname ( $ template ) ; $ file = basename ( $ template ) ; $ twig = new \ Twig_Environment ( new \ Twig_Loader_Filesystem ( array ( $ dir ) ) , array ( 'debug' => true , 'cache' => false , 'strict_variables' => true , 'autoescape' => false , ) ) ; return $ twig -> render ( $ file , $ variables ) ; } | Return the rendered content of a template . |
27,078 | protected function setHasCache ( $ id , $ value ) { if ( ! $ this -> useHasCache ) { return true ; } unset ( $ this -> hasCache [ $ id ] ) ; $ this -> hasCache [ $ id ] = $ value ; if ( count ( $ this -> hasCache ) > $ this -> hasCacheLength ) { $ this -> hasCache = array_slice ( $ this -> hasCache , - $ this -> hasCacheLength , null , true ) ; } return true ; } | Stores index of the container to the cache |
27,079 | protected function getHasCache ( $ id ) { return $ this -> useHasCache && array_key_exists ( $ id , $ this -> hasCache ) ? $ this -> hasCache [ $ id ] : false ; } | Gets index of the container from the cache |
27,080 | public function add ( ContainerInterface $ container , $ name = null ) { if ( $ name !== null ) { $ this -> containers [ $ name ] = $ container ; } else { array_push ( $ this -> containers , $ container ) ; } } | Adds container to the collection |
27,081 | public function addPrepend ( ContainerInterface $ container , $ name = null ) { if ( $ name !== null ) { unset ( $ this -> containers [ $ name ] ) ; $ this -> containers = array_merge ( [ $ name => $ container ] , $ this -> containers ) ; } else { array_unshift ( $ this -> containers , $ container ) ; } } | Adds container to the beginning of the collection |
27,082 | public function getContainer ( $ name ) { if ( ! array_key_exists ( $ name , $ this -> containers ) ) { throw new ContainerNotFoundException ( "No container with name '{$name}' found" ) ; } return $ this -> containers [ $ name ] ; } | Gets named container |
27,083 | public function setUseHasCache ( $ useHasCache = true , $ hasCacheLength = null ) { $ this -> useHasCache = ( bool ) $ useHasCache ; if ( $ hasCacheLength !== null ) { $ this -> hasCacheLength = ( int ) $ hasCacheLength ; } return $ this ; } | Sets the property useHasCache and size of cache |
27,084 | public function teardown ( ExampleNode $ example , Specification $ context , MatcherManager $ matchers , CollaboratorManager $ collaborators ) { if ( ! isset ( $ this -> collaborator ) ) return false ; $ this -> collaborator -> checkProphetPredictions ( ) ; return true ; } | Adds call to unmock all registered mocked functions |
27,085 | public function findAll ( $ page = 1 , $ max = 50 ) { $ offset = ( ( $ page - 1 ) * $ max ) ; $ productOrderItems = $ this -> productOrderItemRepository -> findBy ( array ( ) , array ( ) , $ max , $ offset ) ; return $ productOrderItems ; } | Find al ProductOrderItems with pagination options . |
27,086 | public function create ( ProductOrderItem $ productOrderItem ) { $ this -> getEm ( ) -> persist ( $ productOrderItem ) ; $ this -> getEm ( ) -> flush ( ) ; return $ productOrderItem ; } | Create a new ProductOrderItem . |
27,087 | public function save ( ProductOrderItem $ productOrderItem ) { if ( ! $ productOrderItem -> getId ( ) ) { $ this -> getEm ( ) -> persist ( $ productOrderItem ) ; } $ this -> getEm ( ) -> flush ( ) ; return $ productOrderItem ; } | Save or update ProductOrderItem . |
27,088 | public function delete ( ProductOrderItem $ productOrderItem ) { $ this -> getEm ( ) -> remove ( $ productOrderItem ) ; $ this -> getEm ( ) -> flush ( ) ; } | Delete an ProductOrderItem . |
27,089 | public function exportPublicKeyCommand ( $ publicKeyFingerprint ) { $ publicKey = $ this -> rsaWalletService -> getPublicKey ( $ publicKeyFingerprint ) ; $ this -> output ( $ publicKey -> getKeyString ( ) ) ; } | Export a public key |
27,090 | public function assert ( callable $ callback ) : bool { foreach ( $ this -> items as $ key => $ item ) { if ( $ callback ( $ item , $ key ) === false ) { return false ; } } return true ; } | Assert that all elements pass the test provided by the callback |
27,091 | public function contains ( $ value ) : bool { return \ in_array ( $ value , $ this -> items , ( is_scalar ( $ value ) ? false : true ) ) ; } | Returns true if the value is in the Collection |
27,092 | public function match ( $ regex ) { $ col = new static ( ) ; foreach ( $ this as $ key => $ value ) { if ( \ preg_match ( $ regex , $ key ) ) { $ col [ $ key ] = $ value ; } } return $ col ; } | Find keys and values using a regular expression returning a new Collection |
27,093 | public function max ( $ key = null ) { $ callback = $ this -> valueAccessor ( $ key ) ; return $ this -> filter ( function ( $ value ) { return ! is_null ( $ value ) ; } ) -> reduce ( function ( $ result , $ item ) use ( $ callback ) { $ value = $ callback ( $ item ) ; return is_null ( $ result ) || $ value > $ result ? $ value : $ result ; } ) ; } | Returns the highest value from the collection of values |
27,094 | public function only ( $ keys ) { $ keys = is_array ( $ keys ) ? $ keys : func_get_args ( ) ; return $ this -> filter ( function ( $ value , $ key ) use ( $ keys ) { return in_array ( $ key , $ keys , true ) ; } ) ; } | Returns a new collection containing only these keys |
27,095 | public function pad ( $ size , $ value ) { $ this -> items = \ array_pad ( $ this -> items , $ size , $ value ) ; return $ this ; } | Pads the Collection to size using value as the value of the new elements |
27,096 | public function partition ( $ callback ) { $ partitions = [ new static , new static ] ; $ callback = $ this -> valueAccessor ( $ callback ) ; foreach ( $ this -> items as $ key => $ item ) { $ partitions [ ( int ) ! $ callback ( $ item ) ] [ $ key ] = $ item ; } return new static ( $ partitions ) ; } | Partition the Collection into two Collections using the given callback or key . |
27,097 | public function pipe ( iterable $ items , $ through ) { foreach ( $ this -> items as $ key => $ operator ) { $ new = new static ( ) ; if ( ! Support :: isCallable ( $ through ) ) { $ through = function ( $ operator , $ item , $ key ) use ( $ through ) { return $ operator -> { $ through } ( $ item ) ; } ; } foreach ( $ items as $ item ) { $ new -> set ( $ key , $ through ( $ operator , $ item , $ key ) ) ; } $ items = $ new ; } return $ items ; } | Transformer a passed Collection of items using an Operator method |
27,098 | public function removeEmpty ( array $ empty = [ false , null , '' ] ) { return $ this -> filter ( function ( $ item ) use ( $ empty ) { return ! in_array ( $ item , $ empty , true ) ; } ) ; } | Removes values that are matched as empty through an equivalence check |
27,099 | public function set ( $ key , $ value = null ) { if ( \ is_array ( $ key ) && $ value === null ) { $ this -> items = $ key ; trigger_error ( 'Replacing collection contents via set is deprecated' , E_USER_DEPRECATED ) ; } else { $ this -> offsetSet ( $ key , $ value ) ; } return $ this ; } | Add the item with key to the Collection |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.