idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
56,400 | protected static function populateElement ( ElementInterface $ elm , array $ data ) { self :: setValue ( $ elm , $ data ) ; $ hasAttributes = isset ( $ data [ 'attributes' ] ) && is_array ( $ data [ 'attributes' ] ) ; if ( ! $ hasAttributes ) { return ; } foreach ( $ data [ 'attributes' ] as $ attribute => $ value ) { ... | Sets the properties and dependencies for HTML elements |
56,401 | protected static function getClassName ( $ type ) { if ( in_array ( $ type , array_keys ( self :: $ elements ) ) ) { $ type = self :: $ elements [ $ type ] ; } if ( ! class_exists ( $ type ) ) { throw new InvalidArgumentException ( "Input class '{$type}' does not exists." ) ; } if ( ! is_subclass_of ( $ type , ElementI... | Check the element alias or FQ class name |
56,402 | protected static function setFilters ( InputInterface $ input , array $ data ) { $ hasFilters = isset ( $ data [ 'filters' ] ) && is_array ( $ data [ 'filters' ] ) ; if ( ! $ hasFilters ) { return ; } foreach ( $ data [ 'filters' ] as $ filter ) { $ input -> addFilter ( $ filter ) ; } } | Add filter to the input filter chain |
56,403 | protected static function addValidators ( InputInterface $ input , array $ data ) { $ hasValidators = isset ( $ data [ 'validates' ] ) && is_array ( $ data [ 'validates' ] ) ; if ( ! $ hasValidators ) { return ; } foreach ( $ data [ 'validates' ] as $ validator => $ message ) { self :: checkIfRequired ( $ validator , $... | Add validators to the input validator chain |
56,404 | protected static function addLabel ( InputInterface $ input , array $ data ) { if ( ! isset ( $ data [ 'label' ] ) ) { return ; } if ( is_string ( $ data [ 'label' ] ) ) { $ input -> setLabel ( $ data [ 'label' ] ) ; return ; } $ label = new Label ( '' , $ data [ 'label' ] [ 'value' ] ) ; self :: populateElement ( $ la... | Adds the html Label element to input |
56,405 | protected static function checkIfRequired ( $ name , InputInterface $ input ) { if ( in_array ( $ name , self :: $ triggerRequired ) ) { $ input -> setAttribute ( 'required' ) ; } } | Check if validator triggers the required attribute |
56,406 | protected static function addOptions ( InputInterface $ input , $ data ) { if ( ! $ input instanceof ChoiceAwareElementInterface || ! isset ( $ data [ 'options' ] ) ) { return ; } $ input -> setOptions ( $ data [ 'options' ] ) ; } | Set options for ChoiceAwareElementInterface input types like Select |
56,407 | function withMeta ( $ data ) { $ meta = $ this -> _assertMetaData ( $ data ) ; $ new = clone $ this ; $ new -> meta = array_merge ( $ this -> meta , $ meta ) ; return $ new ; } | Set Meta Data Headers |
56,408 | function getMeta ( $ metaKey = null ) { if ( $ metaKey !== null ) return ( isset ( $ this -> meta [ $ metaKey ] ) ) ? $ this -> meta [ $ metaKey ] : null ; return $ this -> meta ; } | Meta Data Or Headers |
56,409 | protected function _assertMetaData ( $ meta ) { if ( $ meta instanceof \ Traversable ) $ meta = iterator_to_array ( $ meta ) ; $ exception = new \ InvalidArgumentException ( sprintf ( 'Meta Must be Array Or Traversable Associated Key/Value Pair; given: (%s).' , \ Poirot \ Std \ flatten ( $ meta ) ) ) ; if ( ! is_array ... | Assert Given Meta Data |
56,410 | public function getModelsToUpdate ( ) { return $ this -> models -> filter ( function ( AbstractModel $ model ) { return ( $ model -> isChanged ( ) and ( $ model -> isSaved ( ) or $ model -> isSoftDeleted ( ) ) ) ; } ) ; } | Return all the models that are both saved and changed |
56,411 | public function add ( AbstractModel $ model ) { if ( ! $ this -> has ( $ model ) ) { $ this -> addShallow ( $ model ) ; $ modelLinks = $ model -> getRepo ( ) -> getLinkMap ( ) -> get ( $ model ) ; foreach ( $ modelLinks -> getModels ( ) as $ linkedModel ) { $ this -> add ( $ linkedModel ) ; } } return $ this ; } | Add a model traverse all the linked models recursively and add them too . |
56,412 | public function eachLink ( Closure $ yield ) { foreach ( $ this -> models as $ model ) { $ linkMap = $ model -> getRepo ( ) -> getLinkMap ( ) ; if ( $ linkMap -> has ( $ model ) ) { $ links = $ linkMap -> get ( $ model ) -> all ( ) ; foreach ( $ links as $ link ) { if ( ( $ new = $ yield ( $ link ) ) ) { $ this -> addA... | Iterate over all the links of the models Each callback may return a Models object in which case these models are added too . This is useful for relations that modify additional models |
56,413 | public function execute ( ) { $ this -> addFromDeleteRels ( ) ; $ this -> getModelsToDelete ( ) -> byRepo ( function ( Repo $ repo , Models $ models ) { $ repo -> deleteModels ( $ models ) ; } ) ; $ this -> addFromInsertRels ( ) ; $ this -> getModelsToInsert ( ) -> assertValid ( ) -> byRepo ( function ( Repo $ repo , M... | Save all the models to the storage mechanism |
56,414 | public function addArray ( array $ param = null ) { $ this -> param = array_merge ( $ this -> param , $ param ) ; return $ this ; } | adds a array as normal properties |
56,415 | public function send_error_mail ( ) { if ( Config :: get ( 'exception_mail' ) == '' ) return false ; $ error_msg = ( string ) "Script Name: {$_SERVER['SCRIPT_NAME']}\n" ; $ error_msg .= ( string ) "Port: {$_SERVER['SERVER_PORT']}\n" ; $ error_msg .= ( string ) "Query String: {$_SERVER['QUERY_STRING']}\n" ; $ error_msg ... | sends out the error mail based on the exception |
56,416 | function setDomains ( $ domains ) { if ( is_array ( $ domains ) ) $ domains = implode ( ' ' , $ domains ) ; $ this -> domains = ( string ) $ domains ; return $ this ; } | Space - separated list of URIs that define the protection space . |
56,417 | public function setLogType ( $ type ) { if ( empty ( $ type ) ) { $ type = 'log' ; } $ this -> log_type = $ type ; $ this -> function = 'console.' . $ this -> log_type ; } | Sets the console logging type like log info debug etc |
56,418 | public function setLength ( int $ length ) : self { $ this -> minLength = $ length ; $ this -> maxLength = $ length ; return $ this ; } | Sets an exact length . |
56,419 | public function transformParams ( array $ params ) : array { $ newParams = [ ] ; foreach ( $ params as $ key => $ value ) { $ newParams [ '%' . $ key . '%' ] = $ value ; } return $ newParams ; } | Transform params . |
56,420 | public function format ( string $ message ) : string { if ( null === $ this -> params ) { return $ message ; } foreach ( $ this -> transformParams ( $ this -> params ) as $ key => $ value ) { $ message = str_replace ( $ key , $ value , $ message ) ; } return $ message ; } | Get formatted message . |
56,421 | public function sayHello ( \ GearmanJob $ Job ) { $ this -> countJob ( ) ; $ params = json_decode ( $ Job -> workload ( ) , true ) ; return "Hello World!" ; } | A dummy methods . Says hello ... |
56,422 | public function is_valid ( ) { $ ret = false ; if ( is_null ( $ this -> name ) === false && is_null ( $ this -> type ) === false && ( is_null ( $ this -> subtype ) === false || $ this -> type !== 'DISTRIBUTIONLIST' ) && is_null ( $ this -> subscriberList ) === false ) { $ ret = true ; } return $ ret ; } | Validates a modify list |
56,423 | public function Upload ( $ file ) { $ this -> upload = $ file ; if ( $ this -> upload [ 'error' ] != UPLOAD_ERR_OK ) { new \ Sonic \ Message ( 'error' , self :: _uploadError ( $ this -> upload [ 'error' ] ) ) ; return FALSE ; } $ this -> filename = $ this -> upload [ 'name' ] ; $ this -> extension = self :: _getExtensi... | Set the file upload and check for any errors |
56,424 | public function Save ( $ path , $ name = FALSE , $ extension = FALSE ) { if ( ! $ this -> setPath ( $ path ) ) { return FALSE ; } if ( $ name ) { $ this -> name = $ name ; } if ( $ extension ) { $ this -> extension = $ extension ; } $ this -> filename = $ this -> name . '.' . $ this -> extension ; $ tmpPath = $ this ->... | Save the uploaded file to a new location |
56,425 | public function setPath ( $ path ) { if ( ! is_dir ( $ path ) && ! mkdir ( $ path , 0755 , TRUE ) ) { return FALSE ; } if ( ! is_writable ( $ path ) ) { return FALSE ; } $ this -> path = $ path ; return TRUE ; } | Set absolute directory path |
56,426 | public static function _uploadError ( $ error ) { switch ( $ error ) { case UPLOAD_ERR_INI_SIZE : return 'The filesize cannot be more than ' . ini_get ( 'post_max_size' ) ; break ; case UPLOAD_ERR_FORM_SIZE : return 'The filesize cannot be more than ' . $ _POST [ 'MAX_FILE_SIZE' ] ; break ; case UPLOAD_ERR_PARTIAL : re... | Return an upload error string |
56,427 | public static function _getExtension ( $ file ) { $ base = basename ( $ file ) ; $ arr = explode ( '.' , $ base ) ; $ ext = strtolower ( array_pop ( $ arr ) ) ; return $ ext ; } | Return the file extension |
56,428 | public static function _getFilename ( $ file ) { $ base = basename ( $ file ) ; $ arr = explode ( '.' , $ base ) ; array_pop ( $ arr ) ; $ file = NULL ; foreach ( $ arr as $ part ) { $ file .= $ part ; } return $ file ; } | Return the filename without the extension |
56,429 | public function createMigrationsTable ( ) { SchemaManager :: table ( 'migrations' ) -> create ( function ( $ scheme ) { $ scheme -> integer ( 'id' , 11 , false , true , [ 'primary' => true ] ) ; $ scheme -> varchar ( 'class_name' , 255 , false ) ; $ scheme -> varchar ( 'status' , 25 , false ) ; $ scheme -> varchar ( 'p... | Creates migrations table if it does not exist . |
56,430 | protected function getMigrationFilesFromDirectory ( String $ directory ) : Array { $ files = [ ] ; $ tableMigrationsClassFile = $ directory . '/' . Migration :: DEFAULT_MIGRATION_FILENAME . '.php' ; foreach ( glob ( $ directory . '/*' . '.php' ) as $ file ) { if ( $ file !== $ tableMigrationsClassFile ) { $ files [ ] =... | Returns migration files from migrations directory . |
56,431 | public function runMigrations ( ) { $ migrations = Model :: where ( 'status' , 'pending' ) ; if ( $ migrations -> get ( ) -> size ( ) > 0 ) { foreach ( $ migrations -> get ( ) -> all ( ) as $ migration ) { $ this -> runSingleMigration ( $ migration ) ; } } } | Runs all migration classes with pending status . |
56,432 | public function runSingleMigration ( $ migration ) { require_once $ migration -> path ; $ migrationClass = $ migration -> class_name ; if ( ! class_exists ( $ migrationClass ) ) { throw new MigrationClassNotFoundException ( sprintf ( 'Migration class [%s] does not exist' , $ migrationClass ) ) ; } $ class = new $ migra... | Runs a specific migration class . |
56,433 | public function addPaths ( array $ paths ) { $ this -> currentCollectorData = $ this -> filePathCollector -> collect ( ) ; foreach ( $ paths as $ path ) { $ this -> addPath ( $ path ) ; } } | Adds paths to the underlying collectors and tree generators . |
56,434 | private function addPath ( $ path ) { $ paths = $ this -> analyzer -> analyze ( $ path ) ; $ newPaths = [ ] ; foreach ( $ paths as $ filePath ) { $ newPathInformation = $ filePath ; $ newPathInformation [ 'original' ] = $ filePath [ 'path' ] ; if ( $ this -> getCollectorValue ( $ filePath [ 'path' ] ) !== null ) { $ ne... | Adds a single path to the underlying collectors and tree generators . |
56,435 | private function getCollectorValue ( $ key ) { if ( isset ( $ this -> currentCollectorData [ 'sys_pathNames' ] ) ) { if ( array_key_exists ( $ key , $ this -> currentCollectorData [ 'sys_pathNames' ] ) ) { return $ this -> currentCollectorData [ 'sys_pathNames' ] [ $ key ] ; } } return null ; } | Returns the value stored in the path collector for the given path . |
56,436 | public function emitStructure ( $ destination ) { $ this -> treeGenerator -> addPaths ( $ this -> getPaths ( ) ) ; return $ this -> treeGenerator -> generate ( $ destination ) ; } | Creates a directory structure in the provided destination directory . |
56,437 | public static function copy ( $ from , $ to , $ collectorData = [ ] ) { $ manager = app ( get_called_class ( ) ) ; if ( ! is_array ( $ from ) ) { $ from = array ( $ from ) ; } foreach ( $ collectorData as $ key => $ value ) { if ( $ value == null ) { $ manager -> addPathToCollector ( $ key ) ; } else { $ manager -> add... | A helper method to quickly emit the directory structure from either a single file or an array of files to a single output directory . |
56,438 | public static function path ( $ array , $ path , $ default = null , $ delimiter = null ) { if ( ! static :: is ( $ array ) ) { return $ default ; } if ( static :: is ( $ path ) ) { $ keys = $ path ; } else { if ( static :: exists ( $ path , $ array ) ) { return $ array [ $ path ] ; } if ( $ delimiter === null ) { $ del... | Gets a value from an array using a dot separated path . |
56,439 | public static function extract ( $ array , array $ paths , $ default = null ) { $ found = [ ] ; foreach ( $ paths as $ path ) { static :: setPath ( $ found , $ path , static :: path ( $ array , $ path , $ default ) ) ; } return $ found ; } | Retrieves multiple paths from an array . If the path does not exist in the array the default value will be added instead . |
56,440 | public static function callback ( $ str ) { $ command = $ params = null ; if ( preg_match ( '/^([^\(]*+)\((.*)\)$/' , $ str , $ match ) ) { $ command = $ match [ 1 ] ; if ( $ match [ 2 ] !== '' ) { $ params = preg_split ( '/(?<!\\\\),/' , $ match [ 2 ] ) ; $ params = repl ( '\,' , ',' , $ params ) ; } } else { $ comman... | Creates a callable function and parameter list from a string representation . Note that this function does not validate the callback string . |
56,441 | public static function splitOnValue ( $ array , $ value ) { if ( static :: is ( $ array ) ) { $ paramPos = array_search ( $ value , $ array ) ; if ( $ paramPos ) { $ arrays [ ] = array_slice ( $ array , 0 , $ paramPos ) ; $ arrays [ ] = array_slice ( $ array , $ paramPos + 1 ) ; } else { $ arrays = null ; } if ( static... | finds the selected value then splits the array on that key and returns the two arrays if the value was not found then it returns false |
56,442 | public static function where ( $ array , \ Closure $ callback ) { $ filtered = array ( ) ; foreach ( $ array as $ key => $ value ) { if ( call_user_func ( $ callback , $ key , $ value ) ) { $ filtered [ $ key ] = $ value ; } } return $ filtered ; } | Filter the array using the given Closure . |
56,443 | final public function importHTML ( $ text_html ) { $ content = $ this -> importer -> import ( $ text_html ) ; if ( ! ! is_null ( $ content ) ) { $ this -> logger -> logError ( 'E001' , array ( $ text_html ) ) ; } else if ( ! $ content ) { $ this -> logger -> logWarn ( 'W001' , array ( $ text_html ) ) ; } else { $ this ... | Metodo que importa y convierte el contenido html en un objeto DOM . |
56,444 | final public function e ( $ css_selector ) { $ xpath = $ this -> toXPath ( $ css_selector ) ; if ( ! ! $ xpath ) { return new \ PHPTools \ PHPHtmlDom \ Core \ PHPHtmlDomList ( $ this -> xpath -> query ( $ xpath ) ) ; } } | Metodo que permite buscar elementos hijos a partir de un selector css . |
56,445 | private function domImport ( ) { $ dom_import = @ $ this -> dom -> loadHTML ( $ this -> html_content ) ; if ( ! ! $ dom_import ) { $ this -> xpath = new \ DOMXPath ( $ this -> dom ) ; } else { $ this -> logger -> logError ( 'E002' , array ( $ this -> html_content ) ) ; } return $ dom_import ; } | Permite importar el contenido dom del texto html . |
56,446 | private function toXPath ( $ css_selector ) { $ xpath = Null ; try { $ xpath = $ this -> selector -> toXPath ( $ css_selector ) ; } catch ( \ Exception $ e ) { $ this -> logger -> logError ( 'E003' , array ( $ css_selector ) ) ; $ this -> logger -> logError ( 'E000' , array ( $ e -> getMessage ( ) ) ) ; } return $ xpat... | Metodo que convierte un selector css en un xpath |
56,447 | public function get ( $ url , array $ headers = array ( ) ) { curl_setopt ( $ this -> handle , CURLOPT_HTTPGET , true ) ; return $ this -> execute ( $ url , $ headers ) ; } | Executes a GET request . |
56,448 | public function post ( $ url , $ data , array $ headers = array ( ) ) { curl_setopt ( $ this -> handle , CURLOPT_POST , true ) ; curl_setopt ( $ this -> handle , CURLOPT_POSTFIELDS , $ data ) ; return $ this -> execute ( $ url , $ headers ) ; } | Executes a POST request . |
56,449 | public function put ( $ url , $ data , array $ headers = array ( ) ) { curl_setopt ( $ this -> handle , CURLOPT_CUSTOMREQUEST , 'PUT' ) ; $ fields = is_array ( $ data ) ? http_build_query ( $ data ) : $ data ; curl_setopt ( $ this -> handle , CURLOPT_POSTFIELDS , $ fields ) ; $ headers = array_replace ( $ headers , [ '... | Executes a PUT request . |
56,450 | public function putFile ( $ url , $ file , array $ headers = array ( ) ) { $ file = $ this -> openFile ( $ file ) ; $ stat = fstat ( $ file ) ; curl_setopt ( $ this -> handle , CURLOPT_PUT , true ) ; curl_setopt ( $ this -> handle , CURLOPT_INFILE , $ file ) ; curl_setopt ( $ this -> handle , CURLOPT_INFILESIZE , $ sta... | Executes a PUT request using a file . |
56,451 | public function request ( $ method , $ url , $ data = null , array $ headers = array ( ) ) { curl_setopt ( $ this -> handle , CURLOPT_CUSTOMREQUEST , strtoupper ( $ method ) ) ; if ( ! empty ( $ data ) ) { curl_setopt ( $ this -> handle , CURLOPT_POSTFIELDS , $ data ) ; } return $ this -> execute ( $ url , $ headers ) ... | Executes a custom request . |
56,452 | public function setEncoding ( $ encoding ) { if ( ! in_array ( $ encoding , [ self :: ENCODING_IDENTITY , self :: ENCODING_DEFLATE , self :: ENCODING_GZIP , self :: ENCODING_ALL ] ) ) { throw new \ InvalidArgumentException ( 'The encoding must be one of: HttpClient::ENCODING_IDENTITY, HttpClient::ENCODING_DEFLATE, Http... | Sets the encoding . |
56,453 | public function acceptCookies ( $ jarfile = null ) { $ jarfile = $ jarfile ? ( string ) $ jarfile : sys_get_temp_dir ( ) . DIRECTORY_SEPARATOR . 'cookies.txt' ; if ( ! is_file ( $ jarfile ) && ! touch ( $ jarfile ) ) { throw new \ LogicException ( sprintf ( 'Cookie file "%s" could not be opened. Make sure that the dire... | Enables the use of cookies . |
56,454 | public function useProxy ( $ proxy , $ type = self :: PROXY_HTTP , $ auth = self :: AUTH_BASIC ) { $ proxy = ( string ) $ proxy ; if ( ! in_array ( $ type , [ self :: PROXY_HTTP , self :: PROXY_SOCKS5 ] ) ) { throw new \ InvalidArgumentException ( 'The $type parameter must be one of: HttpClient::PROXY_HTTP, HttpClient:... | Enables the use of a proxy . |
56,455 | protected function execute ( $ url , array $ headers = array ( ) ) { curl_setopt ( $ this -> handle , CURLOPT_URL , $ url ) ; curl_setopt ( $ this -> handle , CURLOPT_USERAGENT , $ this -> useragent ) ; curl_setopt ( $ this -> handle , CURLOPT_TIMEOUT , $ this -> timeout ) ; curl_setopt ( $ this -> handle , CURLOPT_ENC... | Really executes a request to the given URL . |
56,456 | protected function parseHeaders ( $ rawHeaders ) { $ headers = array ( ) ; $ lines = explode ( "\r\n" , preg_replace ( '/\x0D\x0A[\x09\x20]+/' , ' ' , $ rawHeaders ) ) ; foreach ( $ lines as $ header ) { if ( preg_match ( '/([^:]+): (.+)/m' , $ header , $ match ) ) { if ( ! isset ( $ headers [ $ match [ 1 ] ] ) ) { $ h... | Parses the given HTTP headers . |
56,457 | private function openFile ( $ file ) { if ( is_resource ( $ file ) ) { if ( get_resource_type ( $ file ) !== 'stream' ) { throw new \ InvalidArgumentException ( 'The given resource is not a file handle.' ) ; } } else { $ filename = ( string ) $ file ; if ( ! is_file ( $ filename ) || ! is_readable ( $ filename ) ) { th... | Opens a file handle . |
56,458 | private function buffer ( $ curl = null , $ line = null ) { static $ buffer ; if ( $ curl ) { $ buffer .= $ line ; return strlen ( $ line ) ; } else { $ return = $ buffer ; $ buffer = '' ; return $ return ; } } | Buffers the line read by curl . When no handle is given returns and clears the content of the buffer . |
56,459 | public function registerAutoloader ( ) { $ this -> app -> afterResolving ( DocumentManagerRegistry :: class , function ( ManagerRegistryInterface $ registry ) { foreach ( $ registry -> getManagers ( ) as $ manager ) { Autoloader :: register ( $ manager -> getConfiguration ( ) -> getProxyDir ( ) , $ manager -> getConfig... | Register proxy and hydrator autoloader |
56,460 | public function setopt ( string $ name , mixed $ value ) : bool { return curl_setopt ( $ this -> ch , $ name , $ value ) ; } | Set an option for the curl transfer |
56,461 | private static function removeCapsLock ( $ password ) { return $ password === Strings :: upper ( $ password ) ? Strings :: lower ( $ password ) : $ password ; } | Fixes caps lock accidentally turned on . |
56,462 | public function reset ( ) { $ this -> inQuotes = false ; $ this -> wasQuoted = false ; $ this -> content = '' ; $ this -> isNull = false ; $ this -> hasContent = false ; } | Reset the state |
56,463 | private function getRandomId ( $ entityClass , $ annotation ) { if ( 'int' === $ annotation -> type || 'integer' === $ annotation -> type ) { return mt_rand ( pow ( 10 , $ annotation -> length - 1 ) , pow ( 10 , $ annotation -> length ) - 1 ) ; } return substr ( hash ( 'sha256' , sprintf ( '%s - %s - %s' , microtime ( ... | Get Random Id |
56,464 | public function processQueues ( ) { foreach ( $ this -> _amqpConfigHelper -> getQueueConfigurationScopes ( ) as $ store ) { $ this -> _store = $ store ; $ this -> _consumeStoreQueues ( $ store ) ; } return $ this ; } | For each store with a unique AMQP configuration consume messages from each configured queue . |
56,465 | protected function _consumeStoreQueues ( Mage_Core_Model_Store $ store ) { foreach ( $ this -> _helper -> getConfigModel ( $ store ) -> queueNames as $ queueName ) { $ this -> _consumeQueue ( $ queueName , $ store ) ; } return $ this ; } | Consume messages from all queues configured for the given store . |
56,466 | protected function _consumeQueue ( $ queue , Mage_Core_Model_Store $ store ) { $ this -> _api = $ this -> _helper -> getSdkAmqp ( $ queue , $ store ) ; $ this -> _api -> openConnection ( ) ; $ this -> _api -> getChannel ( ) -> basic_consume ( $ this -> _helper -> _processQueueName ( $ queue , $ this -> _coreHelper -> g... | Fetch messages from the queue within the store scope . |
56,467 | protected function _dispatchPayload ( IOrderEvent $ payload , Mage_Core_Model_Store $ store ) { $ eventName = $ this -> _eventPrefix . '_' . $ this -> _coreHelper -> underscoreWords ( $ payload -> getEventType ( ) ) ; $ logData = [ 'event_name' => $ eventName , 'payload' => $ payload -> serialize ( ) ] ; $ logMessage =... | Dispacth an event in Magento with the payload and store scope it was received in . |
56,468 | public static function getFirewallNames ( Container $ container ) { $ names = [ ] ; foreach ( $ container -> getServiceIds ( ) as $ serviceId ) { if ( 'security.firewall.map.context.' === substr ( $ serviceId , 0 , 30 ) ) { $ names [ ] = substr ( $ serviceId , 30 ) ; } } return $ names ; } | Get Firewall Names |
56,469 | public static function getFirewallWithAccessListenerNames ( Container $ container ) { $ names = [ ] ; foreach ( self :: getFirewallNames ( $ container ) as $ firewallName ) { $ firewall = $ container -> get ( sprintf ( 'security.firewall.map.context.%s' , $ firewallName ) ) ; if ( 0 === count ( $ firewall -> getContext... | Get Firewall With Access Listener Names |
56,470 | public static function getRandomPassword ( $ length = null , $ countCharsNum = null , $ countCharsSpecial = null ) { $ chars = [ 'alpha' => 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKMNPQRSTUVWXYZ' , 'special' => '!$%&=?*-:;.,+~@_' , ] ; if ( null === $ length ) { $ length = mt_rand ( 9 , 13 ) ; } if ( null === $ countCharsNum ... | Get Random Password |
56,471 | protected function createClient ( ) { $ credentials = $ this -> getCredentials ( ) ; $ url = $ this -> getServiceURL ( ) ; $ transport = ! empty ( $ url [ 'transport' ] ) ? $ url [ 'transport' ] : self :: SECURE_TRANSPORT_DEFAULT ; $ this -> serviceClient = new SocketClient ( $ url [ 'host' ] , $ url [ 'port' ] ) ; $ t... | Initializing socket client |
56,472 | public function sendRequest ( ) { $ notification = $ this -> getNotificationOrThrowException ( ) ; try { $ connection = $ this -> getClientConnection ( ) ; $ connection -> write ( $ notification -> getPayload ( ) ) ; $ errorResponseData = $ connection -> read ( Response :: ERROR_RESPONSE_LENGTH ) ; } catch ( \ Exceptio... | If you send a notification that is accepted by APNs nothing is returned . If you send a notification that is malformed or otherwise unintelligible APNs returns an error - response packet |
56,473 | public static function create ( $ table , $ callback ) { $ table = new Table ( $ table ) ; $ table -> create ( ) ; call_user_func ( $ callback , $ table ) ; return static :: execute ( $ table ) ; } | Create a new database table schema . |
56,474 | public static function rename ( $ table , $ new_name ) { $ table = new Table ( $ table ) ; $ table -> rename ( $ new_name ) ; return static :: execute ( $ table ) ; } | Rename a database table in the schema . |
56,475 | public static function drop ( $ table , $ connection = null ) { $ table = new Table ( $ table ) ; $ table -> on ( $ connection ) ; $ table -> drop ( ) ; return static :: execute ( $ table ) ; } | Drop a database table from the schema . |
56,476 | public static function execute ( $ table ) { static :: implications ( $ table ) ; foreach ( $ table -> commands as $ command ) { $ grammar = static :: grammar ( $ connection ) ; if ( method_exists ( $ grammar , $ method = $ command -> type ) ) { $ statements = $ grammar -> $ method ( $ table , $ command ) ; foreach ( (... | Execute the given schema operation against the database . |
56,477 | protected static function implications ( $ table ) { if ( count ( $ table -> columns ) > 0 && ! $ table -> creating ( ) ) { $ command = new Fluent ( array ( 'type' => 'add' ) ) ; array_unshift ( $ table -> commands , $ command ) ; } foreach ( $ table -> columns as $ column ) { foreach ( array ( 'primary' , 'unique' , '... | Add any implicit commands to the schema table operation . |
56,478 | public static function grammar ( $ driver ) { $ driver = $ connection -> driver ( ) ; switch ( $ driver ) { case 'mysql' : return new Schema \ Grammars \ MySQL ( $ connection ) ; } throw new \ Exception ( "Schema operations not supported for [$driver]." ) ; } | Create the appropriate schema grammar for the driver . |
56,479 | public function take ( $ idx ) { self :: mustBeInteger ( $ idx , 'Index' ) ; if ( $ idx instanceof N ) { $ idx = $ idx -> int ; } if ( ! $ this -> exist ( $ idx ) ) { throw new \ OutOfRangeException ( 'Given ' . $ idx . ' index does not exist!' ) ; } return $ this -> value [ $ idx ] ; } | Gets item having given index . Shorthand for take method . |
56,480 | public function exist ( $ idx ) { self :: mustBeInteger ( $ idx ) ; if ( $ idx instanceof N ) { $ idx = $ idx -> int ; } return array_key_exists ( $ idx , $ this -> value ) ; } | Tests whether given index exists . |
56,481 | public function delete ( $ idx ) { self :: mustBeInteger ( $ idx ) ; if ( $ idx instanceof N ) { $ idx = $ idx -> int ; } if ( ! $ this -> exist ( $ idx ) ) { throw new \ OutOfRangeException ( 'Given ' . $ idx . ' index does not exist!' ) ; } unset ( $ this -> value [ $ idx ] ) ; $ this -> count -- ; return $ this ; } | Deletes element at given position . |
56,482 | public function replace ( $ idx , $ thing ) { self :: mustBeInteger ( $ idx , 'Index' ) ; if ( $ idx instanceof N ) { $ idx = $ idx -> int ; } if ( ! $ this -> exist ( $ idx ) ) { throw new \ OutOfRangeException ( 'Given ' . $ idx . ' index does not exist!' ) ; } $ this -> value [ $ idx ] = $ thing ; return $ this ; } | Replaces element at given position . |
56,483 | public function implode ( $ sep = '' ) { self :: mustBeString ( $ sep , 'Separator' ) ; $ sep = "$sep" ; $ arr = $ this -> value ; foreach ( $ this -> value as $ idx => $ item ) { if ( is_scalar ( $ item ) || is_array ( $ item ) || $ item instanceof A || $ item instanceof H || ( is_object ( $ item ) && method_exists ( ... | Joins all elements into the collection together as a string object . |
56,484 | protected function _array ( ) { $ arr = array_values ( $ this -> value ) ; $ cnt = count ( $ arr ) ; for ( $ i = 0 ; $ i < $ cnt ; $ i ++ ) { $ v = $ arr [ $ i ] ; if ( $ v instanceof A || $ v instanceof H ) { $ arr [ $ i ] = $ v -> array ; } } return $ arr ; } | Converts current collection as a simple array recursively . |
56,485 | public function pad ( $ size , $ value = null ) { self :: mustBeInteger ( $ size , 'Size' ) ; if ( $ size instanceof N ) { $ size = $ size -> int ; } return new self ( array_pad ( $ this -> value , $ size , $ value ) ) ; } | Fill the collection with given element on given size . |
56,486 | public function map ( $ func ) { self :: mustBeCallable ( $ func ) ; return new self ( array_map ( $ func , $ this -> value ) ) ; } | Applys given function arg on every item of the collection . |
56,487 | public function random ( $ n = 1 ) { self :: mustBeInteger ( $ n , 'Number of random items' ) ; if ( $ n instanceof N ) { $ n = $ n -> int ; } if ( ! is_numeric ( $ n ) || $ n < 1 ) { throw new \ InvalidArgumentException ( 'Random items amount must be an integer greater ' . 'than or equal one.' ) ; } if ( $ n > $ this ... | Gets random items from the collection . |
56,488 | public function diff ( $ arr ) { self :: mustBeArrayOrHash ( $ arr ) ; return new self ( array_values ( array_diff ( $ this -> value , self :: toSimpleArray ( $ arr ) ) ) ) ; } | Returns elements not in common into current collection and given one . |
56,489 | public function inter ( $ arr ) { self :: mustBeArrayOrHash ( $ arr ) ; return new self ( array_values ( array_intersect ( $ this -> value , self :: toSimpleArray ( $ arr ) ) ) ) ; } | Gets commons elements into currrent collection and given collection . |
56,490 | public function chunk ( $ size ) { self :: mustBeInteger ( $ size , 'Size' ) ; if ( $ size instanceof N ) { $ size = $ size -> int ; } if ( $ size < 1 ) { throw new \ InvalidArgumentException ( 'Chunk cannot have null size, please use number equal or ' . 'greater than one.' ) ; } $ arr = array_chunk ( $ this -> value ,... | Divides current collection into subcollection having given size . |
56,491 | public function search ( $ foo ) { if ( in_array ( $ foo , $ this -> value ) ) { return new N ( array_search ( $ foo , $ this -> value , true ) ) ; } else { return null ; } } | Search index of the given element . |
56,492 | public function hasRange ( $ arr ) { self :: mustBeArrayOrHash ( $ arr ) ; $ arr = self :: toSimpleArray ( $ arr ) ; if ( empty ( $ arr ) ) { throw new \ RuntimeException ( 'Cannot used empty range to detect it into collection!' ) ; } if ( count ( $ arr ) > count ( $ this -> value ) ) { return false ; } $ arr_idx = arr... | Checks whether current collection has given range inside . |
56,493 | protected function _flatten ( ) { $ arr = array ( ) ; foreach ( $ this -> value as $ idx => $ item ) { if ( is_array ( $ item ) ) { $ item = new A ( $ item ) ; } elseif ( $ item instanceof H ) { $ item = $ item -> to_a ; } if ( $ item instanceof A ) { $ arr_prov = $ item -> flatten -> array ; foreach ( $ arr_prov as $ ... | Flatten the current collection . |
56,494 | public function zip ( ) { $ args = func_get_args ( ) ; $ int_max = 0 ; array_unshift ( $ args , $ this -> value ) ; foreach ( $ args as $ item ) { self :: mustBeArrayOrHash ( $ item ) ; $ item = self :: toSimpleArray ( $ item ) ; $ int_count = count ( $ item ) ; if ( $ int_count > $ int_max ) { $ int_max = $ int_count ... | Combines provided collections with current one . |
56,495 | public static function css ( $ href , array $ attrs = [ ] ) { $ attrs = array_merge ( [ 'type' => 'text/css' , 'rel' => 'stylesheet' , 'href' => $ href , ] , $ attrs ) ; return static :: tag ( 'link' , null , $ attrs ) ; } | css link tag |
56,496 | public function filterBySmartyFilter ( $ smartyFilter , $ comparison = null ) { if ( $ smartyFilter instanceof \ SmartyFilter \ Model \ SmartyFilter ) { return $ this -> addUsingAlias ( SmartyFilterI18nTableMap :: ID , $ smartyFilter -> getId ( ) , $ comparison ) ; } elseif ( $ smartyFilter instanceof ObjectCollection ... | Filter the query by a related \ SmartyFilter \ Model \ SmartyFilter object |
56,497 | public function useSmartyFilterQuery ( $ relationAlias = null , $ joinType = 'LEFT JOIN' ) { return $ this -> joinSmartyFilter ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'SmartyFilter' , '\SmartyFilter\Model\SmartyFilterQuery' ) ; } | Use the SmartyFilter relation SmartyFilter object |
56,498 | public function parse_position ( $ string ) { if ( empty ( $ string ) ) return array ( ) ; $ time_array = array ( 'range' => '*' , 'interval' => false ) ; if ( $ string == '*' ) { return $ time_array ; } else if ( preg_match ( '/^(\d{4})$/' , $ string ) ) { $ time_array [ 'range' ] = $ string ; return $ time_array ; } ... | returns an array with 2 positions - > range which can be an array or a specific time positions |
56,499 | public function load ( $ buffer ) { $ this -> fin = ord ( $ buffer [ 0 ] ) >> 7 ; $ this -> opcode = ord ( $ buffer [ 0 ] ) & ( pow ( 2 , 4 ) - 1 ) ; $ this -> mask = ord ( $ buffer [ 1 ] ) >> 7 ; if ( $ this -> isCtlFrame ( ) ) return ; $ this -> payload_len = ord ( $ buffer [ 1 ] ) & 127 ; $ ext_bytes = 0 ; if ( $ th... | load request from input buffer string |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.