idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
57,600 | public static function removeSectionLanguages ( $ sectionsFile ) { if ( ! is_file ( $ sectionsFile ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Section file "%s" not found.' , $ sectionsFile ) ) ; } $ sections = Yaml :: parse ( $ sectionsFile ) ; foreach ( $ sections as $ section => $ sectionInfo ) { $ secti... | Remove all section languages |
57,601 | public static function populateRedisDictionary ( \ Redis $ redis , $ dictPath , array $ languages = null , $ fileCallback = null ) { $ redisDictionary = new RedisDictionary ( $ redis ) ; $ dictPath = rtrim ( $ dictPath , '/' ) ; if ( ! is_dir ( $ dictPath ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The dire... | Populate redis dictionary storage with use PHP file dictionary |
57,602 | protected function checkEnvVariable ( ) { $ key = $ this -> checkKey ( ) ; $ output = $ this -> execSSH ( "cd $this->domain;cat .env" ) ; if ( str_contains ( $ output , $ key ) ) { $ this -> info ( "Key $key found in remote environment file" ) ; } else { $ this -> error ( "Key $key NOT found in remote environment file"... | Edit remote env variables |
57,603 | public function appendScheme ( Scheme $ scheme ) : self { return new self ( ( string ) $ this -> pregReplace ( '/^[a-zA-Z]*:?\/\//' , ( string ) $ scheme . '://' ) ) ; } | Append the given scheme to the url |
57,604 | public function withQueryString ( QueryString $ query ) : self { $ url = Structure :: fromString ( ( string ) $ this ) -> withQuery ( Query :: fromString ( ( string ) $ query -> substring ( 1 ) ) ) -> withFragment ( new NullFragment ) ; return new self ( ( string ) $ url ) ; } | Return a new url with the given query string |
57,605 | public function withFragment ( Fragment $ fragment ) : self { $ url = Structure :: fromString ( ( string ) $ this ) -> withFragment ( new Frag ( ( string ) $ fragment -> substring ( 1 ) ) ) ; return new self ( ( string ) $ url ) ; } | Return a new url with the given fragment |
57,606 | public function withPath ( Path $ path ) : self { $ url = Structure :: fromString ( ( string ) $ this ) -> withPath ( new UrlPath ( ( string ) $ path ) ) -> withQuery ( new NullQuery ) -> withFragment ( new NullFragment ) ; return new self ( ( string ) $ url ) ; } | Return a new url with the given path |
57,607 | protected function GetBoundary ( $ boundary , $ charSet , $ contentType , $ encoding ) { $ result = '' ; if ( $ charSet == '' ) { $ charSet = $ this -> CharSet ; } if ( $ contentType == '' ) { $ contentType = $ this -> ContentType ; } if ( $ encoding == '' ) { $ encoding = $ this -> Encoding ; } $ result .= $ this -> T... | Returns the start of a message boundary . |
57,608 | protected function EncodeFile ( $ path , $ encoding = 'base64' ) { try { if ( ! is_readable ( $ path ) ) { throw new phpmailerException ( $ this -> Lang ( 'file_open' ) . $ path , self :: STOP_CONTINUE ) ; } if ( function_exists ( 'get_magic_quotes' ) ) { function get_magic_quotes ( ) { return false ; } } if ( version_... | Encodes attachment in requested format . Returns an empty string on failure . |
57,609 | private function sortPaths ( ) { $ this -> normalizePaths ( ) ; uasort ( $ this -> paths , function ( $ a , $ b ) { if ( $ a == $ b ) { return 0 ; } return ( substr_count ( $ a [ 'path' ] , DIRECTORY_SEPARATOR ) > substr_count ( $ b [ 'path' ] , DIRECTORY_SEPARATOR ) ) ? - 1 : 1 ; } ) ; return $ this -> paths ; } | Sorts the paths so that the most specific paths are listed first . |
57,610 | private function removeFilesAndDirectories ( $ destinationDirectory ) { $ currentStructure = $ this -> fileSystem -> allFiles ( $ destinationDirectory ) ; $ removedPaths = [ ] ; foreach ( $ currentStructure as $ file ) { $ directoryPath = $ this -> normalizePath ( $ destinationDirectory . DIRECTORY_SEPARATOR . $ file -... | Removes all files and directories that are set to be automatically removed . |
57,611 | public function generate ( $ destinationDirectory ) { $ destinationDirectory = $ destinationDirectory ; $ generatedPaths = [ ] ; $ this -> resolveAutomaticallyIgnoredPaths ( $ destinationDirectory ) ; foreach ( $ this -> getPaths ( ) as $ pathKey => $ path ) { $ fullPath = $ destinationDirectory . DIRECTORY_SEPARATOR .... | Creates the file tree in the given directory . |
57,612 | private function resolveAutomaticallyIgnoredPaths ( ) { foreach ( $ this -> paths as $ path ) { if ( is_array ( $ path ) ) { $ path = $ path [ 'home' ] ; } if ( ! Str :: endsWith ( $ path , $ this -> normalizePath ( '_template/' ) ) ) { $ ignoredPath = $ this -> normalizePath ( realpath ( $ path . '/composer.json' ) ) ... | Resolves the automatically ignored paths . |
57,613 | private function shouldBeIgnored ( $ path ) { $ path = $ this -> normalizePath ( $ path ) ; if ( $ this -> isAutomaticallyIgnored ( $ path ) ) { return true ; } foreach ( $ this -> ignoredPaths as $ ignoredPath ) { if ( Str :: is ( $ this -> normalizePath ( $ ignoredPath ) , $ path ) ) { return true ; } } return false ... | Determines if a path should be ignored . |
57,614 | private function shouldBeRemoved ( $ path ) { $ path = $ this -> normalizePath ( $ path ) ; if ( Str :: is ( '*newup.keep' , $ path ) ) { return true ; } foreach ( $ this -> automaticallyRemovedPaths as $ removedPath ) { if ( Str :: is ( $ this -> normalizePath ( $ removedPath ) , $ path ) ) { return true ; } } return ... | Determines if a path should be removed . |
57,615 | public function removeIgnoredPath ( $ path ) { array_remove_value ( $ this -> ignoredPaths , $ path ) ; $ this -> ignoredPaths = array_values ( $ this -> ignoredPaths ) ; } | Removes the specified ignored path . |
57,616 | public function removeAutomaticallyRemovedPath ( $ path ) { array_remove_value ( $ this -> automaticallyRemovedPaths , $ path ) ; $ this -> automaticallyRemovedPaths = array_values ( $ this -> automaticallyRemovedPaths ) ; } | Removes the specified automatically - removed path . |
57,617 | public static function get_version ( $ package = 'project' ) { if ( Config :: $ version_storage == 'file' ) { return self :: file_get_version ( $ package ) ; } elseif ( Config :: $ version_storage == 'database' ) { return self :: database_get_version ( $ package ) ; } else { throw new \ Exception ( 'Incorrect "version_... | Get current version |
57,618 | private static function file_get_version ( $ package ) { if ( file_exists ( Config :: $ migration_directory . '/db_version' ) ) { $ version_file = trim ( file_get_contents ( Config :: $ migration_directory . '/db_version' ) ) ; $ version = json_decode ( $ version_file , true ) ; } else { $ version = null ; } if ( $ ver... | Get the currect version from file |
57,619 | private static function database_get_version ( $ package ) { if ( ! class_exists ( '\Skeleton\Database\Database' ) ) { throw new \ Exception ( 'Skeleton database is not active' ) ; } $ table = Config :: $ database_table ; $ db = \ Skeleton \ Database \ Database :: get ( ) ; try { $ result = $ db -> query ( 'DESC ' . $ ... | Get the current version from database |
57,620 | public static function set_version ( $ package = 'project' , \ Datetime $ version ) { if ( Config :: $ version_storage == 'file' ) { return self :: file_set_version ( $ package , $ version ) ; } elseif ( Config :: $ version_storage == 'database' ) { return self :: database_set_version ( $ package , $ version ) ; } else... | Set a version |
57,621 | private static function file_set_version ( $ package , \ Datetime $ version ) { self :: get_version ( $ package ) ; if ( file_exists ( Config :: $ migration_directory . '/db_version' ) ) { $ version_file = trim ( file_get_contents ( Config :: $ migration_directory . '/db_version' ) ) ; $ versions = json_decode ( $ vers... | File Set version |
57,622 | private static function database_set_version ( $ package , \ Datetime $ version ) { $ db = \ Skeleton \ Database \ Database :: get ( ) ; $ table = Config :: $ database_table ; $ data = [ 'package' => $ package , 'version' => $ version -> format ( 'Y-m-d H:i:s' ) , ] ; $ row = $ db -> get_row ( 'SELECT * FROM `' . $ tab... | Database Set version |
57,623 | public function makePrecise ( $ numeric ) : float { if ( ! is_numeric ( $ numeric ) || is_nan ( $ numeric ) ) { return NAN ; } $ n = NAN ; if ( $ this -> mode === self :: FIXED ) { $ n = $ this -> makeFixed ( $ numeric ) ; } else { $ n = round ( $ numeric , $ this -> precision , $ this -> mode ) ; } return $ n ; } | Makes a scalar value precise using this model . |
57,624 | public function setHost ( $ url ) { if ( filter_var ( $ url , FILTER_VALIDATE_URL ) === false ) { throw new \ InvalidArgumentException ( 'Invalid Host URL' ) ; } $ this -> host = $ url ; } | Set host name |
57,625 | public function setDefaultImage ( $ url ) { if ( filter_var ( $ url , FILTER_VALIDATE_URL ) === false ) { throw new \ InvalidArgumentException ( 'Invalid Default Image URL' ) ; } $ this -> defaultImage = $ url ; } | Set default image url |
57,626 | private function filename ( $ url , $ title = '' ) { if ( ! empty ( $ title ) ) { $ filename = $ this -> slug ( $ title ) ; } else { $ filename = $ this -> slug ( pathinfo ( $ url , PATHINFO_FILENAME ) ) ; } $ extention = pathinfo ( $ url , PATHINFO_EXTENSION ) ; if ( ! empty ( $ extention ) ) { return $ filename . '.'... | Get seo slug and file extention |
57,627 | public function canSendHeaders ( $ throw = false ) { $ ok = headers_sent ( $ file , $ line ) ; if ( $ ok && $ throw && $ this -> headersSentThrowsException ) { throw new Exception ( 'Cannot send headers; headers already sent in ' . $ file . ', line ' . $ line ) ; } return ! $ ok ; } | Can we send headers? |
57,628 | public function sendDataAsHtml ( $ data ) { $ this -> disableView ( ) ; if ( extension_loaded ( 'xdebug' ) ) { ob_start ( ) ; var_dump ( $ data ) ; $ output = ob_get_clean ( ) ; } else { $ output = sprintf ( '<pre><code>%s</code></pre>' , json_encode ( $ data , JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ) ) ; } $ this ... | format and send json_encode able object or array |
57,629 | public function sendDataAsJson ( $ data ) { $ this -> disableView ( ) ; $ this -> setContentType ( 'application/json' , 'UTF-8' ) ; if ( is_object ( $ data ) ) { if ( method_exists ( $ data , 'toArray' ) ) $ data = $ data -> toArray ( ) ; } if ( empty ( $ data ) ) $ data = new \ stdClass ( ) ; $ this -> setJsonContent ... | jsonify and send data |
57,630 | function export ( ) { $ export = array_merge ( $ this -> data , $ this -> cell ) ; foreach ( $ export as & $ val ) { if ( $ val instanceof Cell ) { if ( $ val -> isExpr ( ) ) { throw new \ UnexpectedValueException ( "Cannot export an SQL expression" ) ; } $ val = $ val -> get ( ) ; } } return $ export ; } | Export current state as an array |
57,631 | function refresh ( ) { $ this -> data = $ this -> table -> find ( $ this -> criteria ( ) , null , 1 , 0 ) -> current ( ) -> data ; $ this -> cell = array ( ) ; return $ this ; } | Refresh the rows data |
57,632 | protected function prime ( ) { $ this -> cell = array ( ) ; foreach ( $ this -> data as $ key => $ val ) { $ this -> cell [ $ key ] = new Cell ( $ this , $ key , $ val , true ) ; } return $ this ; } | Fill modified cells |
57,633 | protected function criteria ( ) { $ where = array ( ) ; foreach ( $ this -> getIdentity ( ) as $ col => $ val ) { if ( isset ( $ val ) ) { $ where [ "$col=" ] = $ val ; } else { $ where [ "$col IS" ] = new QueryExpr ( "NULL" ) ; } } return $ where ; } | Transform the row s identity to where criteria |
57,634 | protected function changes ( ) { $ changes = array ( ) ; foreach ( $ this -> cell as $ name => $ cell ) { if ( $ cell -> isDirty ( ) ) { $ changes [ $ name ] = $ cell -> get ( ) ; } } return $ changes ; } | Get an array of changed properties |
57,635 | function __isset ( $ p ) { return isset ( $ this -> data [ $ p ] ) || isset ( $ this -> cell [ $ p ] ) ; } | Check if a cell isset |
57,636 | function ofWhich ( $ foreign , $ ref = null ) { if ( ! ( $ foreign instanceof Table ) ) { $ foreign = forward_static_call ( [ get_class ( $ this -> getTable ( ) ) , "resolve" ] , $ foreign ) ; } return $ foreign -> by ( $ this , $ ref ) ; } | Get the parent row |
57,637 | function allOf ( $ foreign , $ ref = null , $ order = null , $ limit = 0 , $ offset = 0 ) { if ( ! ( $ foreign instanceof Table ) ) { $ foreign = forward_static_call ( [ get_class ( $ this -> getTable ( ) ) , "resolve" ] , $ foreign ) ; } return $ foreign -> of ( $ this , $ ref , $ order , $ limit , $ offset ) ; } | Get child rows of this row by foreign key |
57,638 | function create ( ) { $ this -> table -> notify ( $ this , "create" ) ; $ rowset = $ this -> table -> create ( $ this -> changes ( ) ) ; if ( ! count ( $ rowset ) ) { throw new \ UnexpectedValueException ( "No row created" ) ; } $ this -> data = $ rowset -> current ( ) -> data ; $ this -> cell = array ( ) ; return $ th... | Create this row in the database |
57,639 | function update ( ) { $ where = $ this -> criteria ( ) ; $ this -> table -> notify ( $ this , "update" , $ where ) ; $ rowset = $ this -> table -> update ( $ where , $ this -> changes ( ) ) ; if ( ! count ( $ rowset ) ) { throw new \ UnexpectedValueException ( "No row updated" ) ; } $ this -> data = $ rowset -> current... | Update this row in the database |
57,640 | function delete ( ) { $ this -> table -> notify ( $ this , "delete" ) ; $ rowset = $ this -> table -> delete ( $ this -> criteria ( ) , "*" ) ; if ( ! count ( $ rowset ) ) { throw new \ UnexpectedValueException ( "No row deleted" ) ; } $ this -> data = $ rowset -> current ( ) -> data ; return $ this -> prime ( ) ; } | Delete this row in the database |
57,641 | public function retry ( $ afterDelay = 0 ) { $ this -> transaction -> state = 'retry' ; if ( $ afterDelay ) { $ this -> transaction -> request -> getConfig ( ) -> set ( 'delay' , $ afterDelay ) ; } $ this -> stopPropagation ( ) ; } | Mark the request as needing a retry and stop event propagation . |
57,642 | public static function cronExpression ( $ expression ) { try { $ cron = CronExpression :: factory ( $ expression ) ; $ s = $ cron -> getNextRunDate ( ) -> format ( 'c' ) ; $ e = $ cron -> getExpression ( ) ; $ e_array = preg_split ( '/\s/' , $ e , - 1 , PREG_SPLIT_NO_EMPTY ) ; $ e_count = count ( $ e_array ) ; if ( $ e... | Validate a cron expression and if valid return next run timestamp plus an array of expression parts |
57,643 | public function addDictionaryMeta ( $ item ) { if ( \ is_string ( $ item ) ) { $ item = [ 'name' => $ item , 'table' => $ item , 'map' => $ item , ] ; } $ name = $ item [ 'name' ] ; $ table = ( $ item [ 'table' ] ?? $ name ) ; $ map = ( $ item [ 'map' ] ?? $ name ) ; $ this -> dictionaryMeta [ $ name ] = [ 'table' => $... | Add a dictionary meta information . |
57,644 | public function getAvailableDictionaryInformation ( ) : \ Traversable { $ languages = $ this -> getContaoLanguages ( ) ; foreach ( $ languages as $ sourceLanguage ) { foreach ( $ languages as $ targetLanguage ) { if ( $ sourceLanguage === $ targetLanguage ) { continue ; } foreach ( array_keys ( $ this -> dictionaryMeta... | Obtain all dictionary information . |
57,645 | private function getContaoLanguages ( ) : array { $ languages = [ ] ; foreach ( $ this -> connection -> createQueryBuilder ( ) -> select ( 'language' , 'id' , 'fallback' ) -> from ( 'tl_page' ) -> where ( 'type=:type' ) -> setParameter ( 'type' , 'root' ) -> orderBy ( 'fallback' ) -> addOrderBy ( 'sorting' ) -> execute... | Fetch all languages from Contao . |
57,646 | public function queryBuilder ( ConnectionInterface $ connection , String $ connectionId = null ) : QueryBuilderProvider { return new QueryBuilder ( $ connection , $ connectionId ) ; } | We re using the default query builder . |
57,647 | public function init ( ) { if ( is_array ( $ this -> owner -> config ( ) -> admin_style ) ) { $ this -> styles = $ this -> owner -> config ( ) -> admin_style ; } if ( ! $ this -> owner -> config ( ) -> admin_style_disabled ) { Requirements :: customCSS ( $ this -> generateCustomCSS ( ) ) ; } } | Event handler method triggered when the admin initialises . |
57,648 | public function pointingTo ( RelativePath $ path ) : self { $ folder = $ this -> clean ( ) ; if ( ! $ this -> isFolder ( ) ) { $ folder = $ this -> folder ( ) ; } if ( ( string ) $ path -> substring ( 0 , 2 ) === './' ) { $ path = $ path -> substring ( 2 ) ; } if ( ( string ) $ path -> substring ( 0 , 3 ) === '../' ) {... | Resolve the wished directory |
57,649 | public function load ( ) { $ filter = 'wp_grunticon_enqueue_scripts' ; if ( is_admin ( ) ) { $ filter = 'wp_grunticon_admin_enqueue_scripts' ; } $ queue = apply_filters ( $ filter , array ( ) ) ; if ( ! empty ( $ queue ) ) { $ noscript = array ( ) ; echo '<script type="text/javascript">' ; echo 'window.grunticon=functi... | Loads Grunticon and enqueues Grunticon resources . |
57,650 | protected function _buildPayload ( ) { $ this -> _payload -> setOrderType ( static :: ORDER_TYPE ) -> setCustomerOrderId ( $ this -> _order -> getIncrementId ( ) ) -> setReasonCode ( $ this -> _getReasonCode ( ) ) -> setReason ( $ this -> _getReasonDescription ( ) ) ; return $ this ; } | Populate order cancel payload . |
57,651 | public static function getSkill ( int $ id ) : Skill { self :: initializeSkills ( ) ; if ( ! isset ( self :: $ skills [ $ id ] ) ) { throw new RuneScapeException ( sprintf ( "Skill with id %d does not exist." , $ id ) ) ; } return self :: $ skills [ $ id ] ; } | Retrieve a skill by ID . You can use the SKILL_ constants in this class for IDs . |
57,652 | public function getLevel ( int $ xp ) : int { $ level = $ this -> getVirtualLevel ( $ xp ) ; $ cap = $ this -> isHighLevelCap ( ) ? 120 : 99 ; return min ( $ level , $ cap ) ; } | Returns the level in this skill for the given XP . |
57,653 | public function getVirtualLevel ( int $ xp ) : int { $ xpTable = $ this -> getXpTable ( ) ; for ( $ level = 1 ; $ level <= count ( $ xpTable ) ; $ level ++ ) { if ( $ xpTable [ $ level ] > $ xp ) { $ level -- ; break ; } } $ level = max ( $ this -> getMinimumLevel ( ) , $ level ) ; return $ level ; } | Returns the level in this skill for the given XP disregarding the maximum level in the skill . |
57,654 | public function getXp ( int $ level ) { $ xpTable = $ this -> getXpTable ( ) ; if ( ! isset ( $ xpTable [ $ level ] ) ) { return false ; } return $ xpTable [ $ level ] ; } | Returns the XP corresponding to the given level of this skill . Returns false if the level is too high or low to be represented . |
57,655 | protected function setupAnnotationMetadata ( ) { $ annotationFiles = ( array ) $ this -> getOption ( 'annotation_files' ) ; array_walk ( $ annotationFiles , function ( $ file ) { if ( ! file_exists ( $ file ) ) { throw new \ RuntimeException ( sprintf ( '"%s" file does not exist' , $ file ) ) ; } AnnotationRegistry :: ... | Set up annotation metadata . |
57,656 | protected function parseMetadataMapping ( MappingDriverChain $ metadataDriverChain ) { foreach ( ( array ) $ this -> getOption ( 'metadata_mapping' ) as $ metadataMapping ) { if ( ! is_array ( $ metadataMapping ) ) { $ metadataMapping = [ 'driver' => $ metadataMapping ] ; } if ( ! array_key_exists ( 'namespace' , $ met... | Parse metadata mapping configuration . |
57,657 | protected function getMappingDriver ( array $ metadataMapping ) { if ( array_key_exists ( 'driver' , $ metadataMapping ) ) { $ mappingDriver = $ metadataMapping [ 'driver' ] ; if ( ! $ mappingDriver instanceof MappingDriver ) { throw new \ UnexpectedValueException ( sprintf ( 'Provided driver should be of the type Mapp... | Retrieve mapping driver . |
57,658 | protected function getMappingDriverImplementation ( $ type , $ paths , $ extension ) { switch ( $ type ) { case ManagerBuilder :: METADATA_MAPPING_ANNOTATION : return $ this -> getAnnotationMappingDriver ( $ paths ) ; case ManagerBuilder :: METADATA_MAPPING_XML : return $ this -> getXmlMappingDriver ( $ paths , $ exten... | Get metadata mapping driver implementation . |
57,659 | protected function getEventSubscribers ( ) { $ eventSubscribers = $ this -> getOption ( 'event_subscribers' ) ; if ( is_null ( $ eventSubscribers ) || ! is_array ( $ eventSubscribers ) ) { return ; } return array_filter ( $ eventSubscribers , function ( $ subscriber ) { return $ subscriber instanceof EventSubscriber ; ... | Get event subscribers . |
57,660 | public function create ( Table $ table , Fluent $ command ) { $ columns = implode ( ', ' , $ this -> columns ( $ table ) ) ; $ sql = 'CREATE TABLE ' . $ this -> wrap ( $ table ) . ' (' . $ columns . ')' ; if ( ! is_null ( $ table -> engine ) ) { $ sql .= ' ENGINE = ' . $ table -> engine ; } return $ sql ; } | Generate the SQL statements for a table creation command . |
57,661 | protected function columns ( Table $ table ) { $ columns = array ( ) ; foreach ( $ table -> columns as $ column ) { $ sql = $ this -> wrap ( $ column ) . ' ' . $ this -> type ( $ column ) ; $ elements = array ( 'nullable' , 'defaults' , 'incrementer' ) ; foreach ( $ elements as $ element ) { $ sql .= $ this -> $ elemen... | Create the individual column definitions for the table . |
57,662 | public function primary ( Table $ table , Fluent $ command ) { return $ this -> key ( $ table , $ command -> name ( null ) , 'PRIMARY KEY' ) ; } | Generate the SQL statement for creating a primary key . |
57,663 | protected function key ( Table $ table , Fluent $ command , $ type ) { $ keys = $ this -> columnize ( $ command -> columns ) ; $ name = $ command -> name ; return 'ALTER TABLE ' . $ this -> wrap ( $ table ) . " ADD {$type} {$name}({$keys})" ; } | Generate the SQL statement for creating a new index . |
57,664 | public function drop_column ( Table $ table , Fluent $ command ) { $ columns = array_map ( array ( $ this , 'wrap' ) , $ command -> columns ) ; $ columns = implode ( ', ' , array_map ( function ( $ column ) { return 'DROP ' . $ column ; } , $ columns ) ) ; return 'ALTER TABLE ' . $ this -> wrap ( $ table ) . ' ' . $ co... | Generate the SQL statement for a drop column command . |
57,665 | public function request ( $ method , $ url , $ params = [ ] , $ multipart = false ) { return $ this -> curlRequest ( $ url , $ params , $ method , $ multipart ) ; } | Performs an authenticated OAuth Request |
57,666 | protected function curlRequest ( $ url , $ params = [ ] , $ method = 'GET' , $ multipart = false ) { $ curl = curl_init ( ) ; $ requestUrl = $ url ; if ( $ method == 'GET' ) { $ requestUrl = $ url . '?' . $ this -> formatQueryString ( $ params ) ; } else { curl_setopt ( $ curl , CURLOPT_POST , true ) ; if ( $ multipart... | Performs a OAuth curl request . |
57,667 | public static function addStyle ( $ handle , $ src = '' , $ deps = array ( ) , $ ver = false , $ media = 'all' ) { $ callback = function ( ) use ( & $ handle , & $ src , & $ deps , & $ ver , & $ media ) { wp_enqueue_style ( $ handle , $ src , $ deps , $ ver , $ media ) ; } ; Action :: wpEnqueueScripts ( $ callback ) ; ... | Enqueue a CSS stylesheet . |
57,668 | public static function addScript ( $ handle , $ src = '' , $ deps = array ( ) , $ ver = false , $ in_footer = false ) { $ callback = function ( ) use ( & $ handle , & $ src , & $ deps , & $ ver , & $ in_footer ) { wp_enqueue_script ( $ handle , $ src , $ deps , $ ver , $ in_footer ) ; } ; Action :: wpEnqueueScripts ( $... | Enqueue a script . |
57,669 | public static function fromXml ( \ DOMElement $ xml ) { $ static = new static ( ) ; $ isRenewable = $ xml -> getElementsByTagName ( 'renewable' ) ; $ static -> isRenewable = BoolLiteral :: fromXml ( $ isRenewable ) ; $ message = $ xml -> getElementsByTagName ( 'renewableMessage' ) ; $ static -> message = StringLiteral ... | Builds a Renewable object from XML . |
57,670 | public function stop ( ) { if ( $ this -> isStopping ) return ; $ this -> isStopping = true ; $ this -> buffer = '' ; $ this -> connectRetryCount = 0 ; $ this -> readRetryCount = 0 ; if ( $ this -> request ) { $ this -> request -> close ( ) ; $ this -> request = null ; } if ( $ this -> response ) { $ this -> response -... | Stop reading stream |
57,671 | public function addServer ( $ host , $ port , $ weight = 0 ) { return $ this -> connection -> addServer ( $ host , $ port , $ weight ) ; } | Agrega un servidor al sistema memcache |
57,672 | protected function validateMethod ( $ method ) { $ valid = [ 'GET' => true , 'POST' => true , 'DELETE' => true , 'PUT' => true , 'PATCH' => true , 'HEAD' => true , 'OPTIONS' => true , ] ; if ( ! isset ( $ valid [ $ method ] ) ) { throw new InvalidArgumentException ( 'Invalid method version. Must be one of: GET, POST, D... | Validate request method . |
57,673 | public static function map ( $ array , $ from , $ to = null , $ group = null ) { if ( is_null ( $ to ) ) { $ to = function ( $ element , $ defaultValue ) { return $ element ; } ; } return parent :: map ( $ array , $ from , $ to , $ group ) ; } | Extends ArrayHelper s map capability by letting it map to its parent object . |
57,674 | public function login ( $ id , $ name , $ password ) { $ this -> _session -> set ( 'user' , array ( 'id' => $ id , 'name' => $ name , 'password' => $ password ) ) ; return $ this ; } | Stores an id name and password for the user session . |
57,675 | private static function initStyles ( ) { if ( empty ( self :: $ styles ) ) { foreach ( self :: $ styleColours as $ colourCode => $ class ) { self :: $ styles [ $ colourCode ] = new $ class ( ) ; foreach ( self :: $ styleVariants as $ varCode => $ var ) { self :: $ styles [ $ colourCode . $ varCode ] = new $ class ( $ v... | Initialises the style objects |
57,676 | public function concat ( string $ delimiter = Text :: BLANK_TEXT ) : Text { $ imploded = implode ( $ delimiter , $ this -> toArrayOfStrings ( ) ) ; return Text :: make ( $ imploded ) ; } | Concatena los textos |
57,677 | public function set ( $ name , $ value = null , $ minutes = null , $ path = null , $ domain = null , $ secure = false , $ httpOnly = true ) { $ minutes = is_null ( $ minutes ) ? config ( 'session.lifetime' , 0 ) : $ minutes ; $ this -> queue ( $ name , $ value , $ minutes , $ path , $ domain , $ secure , $ httpOnly ) ;... | Adicionar cookie na fila . |
57,678 | public function forget ( $ name , $ path = null , $ domain = null ) { return $ this -> set ( $ name , null , - 2628000 , $ path , $ domain ) ; } | Destruir um cookie . |
57,679 | public static function Rz ( $ psi , array & $ r ) { $ s ; $ c ; $ a00 ; $ a01 ; $ a02 ; $ a10 ; $ a11 ; $ a12 ; $ s = sin ( $ psi ) ; $ c = cos ( $ psi ) ; $ a00 = $ c * $ r [ 0 ] [ 0 ] + $ s * $ r [ 1 ] [ 0 ] ; $ a01 = $ c * $ r [ 0 ] [ 1 ] + $ s * $ r [ 1 ] [ 1 ] ; $ a02 = $ c * $ r [ 0 ] [ 2 ] + $ s * $ r [ 1 ] [ 2 ... | - - - - - - i a u R z - - - - - - |
57,680 | public function postLoad ( LifecycleEventArgs $ event ) { $ entity = $ event -> getEntity ( ) ; if ( ! ( $ entity instanceof Menu ) ) { return ; } $ builder = $ this -> builderRegistry -> getBuilder ( $ entity -> getType ( ) ) ; $ entity -> setBuilder ( $ builder ) ; } | Injects the associated MenuBuilder for each Menu |
57,681 | public function startWithFunction ( $ needle , $ haystack = [ ] ) { if ( in_array ( $ needle , $ haystack ) ) { return true ; } else { foreach ( $ haystack as $ item ) { if ( strpos ( $ needle , $ item ) === 0 ) { return true ; } } } return false ; } | Checks if at least one item from haystack starts with needle |
57,682 | public function endWithFunction ( $ needle , $ haystack = [ ] ) { if ( in_array ( $ needle , $ haystack ) ) { return true ; } else { foreach ( $ haystack as $ item ) { $ length = strlen ( $ needle ) ; if ( substr ( $ haystack , - $ length ) === $ needle ) { return true ; } } } return false ; } | Checks if at least one item from haystack ends with needle |
57,683 | public function toArrayFunction ( $ object ) { if ( is_string ( $ object ) ) { return json_decode ( $ object , true ) ; } return json_decode ( json_encode ( $ object ) , true ) ; } | Converts stdObject or json string to traversable array |
57,684 | static function getSimpleSessionData ( $ return_to = "/" ) { $ data = [ ] ; $ current_user = UserService :: getCurrentUser ( ) ; $ data [ "logout_url" ] = self :: createLogoutURL ( ) ; $ data [ "login_url" ] = self :: createLoginURL ( $ return_to ) ; $ data [ "google_login_url" ] = self :: getAuthRedirectUrl ( ) ; $ da... | Simple method created for very simple session method for backend frontend communication . |
57,685 | public function getFunctionInstance ( ) { if ( is_string ( $ this -> argument ) ) $ this -> argument = new Attr ( $ this -> argument ) ; if ( ! $ this -> argument instanceof Field ) throw new \ InvalidArgumentException ( sprintf ( "Function '%s' expects an argument of type string or \eMapper\Query\Field" , $ this -> ge... | Obtains a Func instance for this object |
57,686 | public function execute ( PDO $ pdo ) { try { $ stmt = $ pdo -> prepare ( $ this -> getSql ( ) ) ; $ this -> statementExecute ( $ stmt , $ this -> getWhereData ( ) ) ; $ this -> checkAffected ( $ stmt , new NoRecordsAffectedSelectException ( ) ) ; $ data = $ this -> fetchData ( $ stmt , $ this -> getFetchFlat ( ) , $ t... | Runs a query and returns the result of the SQL |
57,687 | protected function statementExecute ( PDOStatement $ stmt , array $ whereData ) { if ( count ( $ whereData ) > 0 ) { return $ stmt -> execute ( $ whereData ) ; } return $ stmt -> execute ( ) ; } | Runs the sql statement inserting the query s data |
57,688 | protected function fetchData ( PDOStatement $ stmt , $ fetchFlat , $ fetchStyle ) { if ( $ fetchFlat ) { return $ stmt -> fetch ( $ fetchStyle ) ; } return $ stmt -> fetchAll ( $ fetchStyle ) ; } | Fetches the data from PDO resource |
57,689 | public function getSql ( ) { $ sqlTemplate = "SELECT %s FROM %s %s" ; $ fieldsCompiled = implode ( ',' , $ this -> getFields ( ) ) ; return trim ( sprintf ( $ sqlTemplate , $ fieldsCompiled , $ this -> getTable ( ) , $ this -> getWhereStatement ( ) ) ) ; } | returns a PDO SQL string that has parameter syntax |
57,690 | public function setRecognizer ( $ params ) { if ( is_array ( $ params ) && ! isset ( $ params [ 'class' ] ) ) { $ params [ 'class' ] = Recognizer :: className ( ) ; } $ this -> _recognizer = Yii :: createObject ( $ params ) ; } | Set client language recognizer . |
57,691 | public function runRecognizer ( ) { $ recognizer = $ this -> getRecognizer ( ) ; $ this -> trigger ( static :: EVENT_BEFORE_RECOGNIZE , new Event ( [ 'sender' => $ this ] ) ) ; $ language = $ recognizer -> handle ( ) ; $ this -> trigger ( static :: EVENT_AFTER_RECOGNIZE , new Event ( [ 'sender' => $ this ] ) ) ; if ( $... | Run recognizer . |
57,692 | public static function __ ( $ message , $ params = [ ] , $ language = null ) { return Yii :: t ( static :: $ defaultContext , $ message , $ params , $ language ) ; } | Get a translated message without context . |
57,693 | public static function _e ( $ message , $ params = [ ] , $ language = null ) { echo Yii :: t ( static :: $ defaultContext , $ message , $ params , $ language ) ; } | Print a translated message without context . |
57,694 | public static function _x ( $ message , $ context , $ params = [ ] , $ language = null ) { return Yii :: t ( $ context , $ message , $ params , $ language ) ; } | Get a translated message with context . |
57,695 | public static function _xe ( $ message , $ context , $ params = [ ] , $ language = null ) { echo Yii :: t ( $ context , $ message , $ params , $ language ) ; } | Print a translated message with context . |
57,696 | private function setRoutes ( ) : void { $ this -> routes = $ this -> routeProvider -> getRoutes ( ) ; $ this -> syRouteCollection = new RouteCollection ( ) ; foreach ( $ this -> routes as $ route ) { $ syRoute = new SymfonyRoute ( $ route -> getPath ( ) , $ route -> getParamsDefaults ( ) , $ route -> getParamsRequireme... | Converts the Route objects provided by the RouteProvider service into a Sy RouteCollection . |
57,697 | public static function get ( string $ type ) : AbstractWriter { if ( ! \ array_key_exists ( $ type , static :: $ invokableClasses ) ) { throw new InvalidArgumentException ( 'Unsupported config file type: ' . $ type ) ; } return new static :: $ invokableClasses [ $ type ] ; } | Returns config writer class |
57,698 | public function addResult ( $ result , $ value ) { if ( ! $ this -> open ) { return ; } if ( $ value !== null ) { $ this -> results [ $ result ] = $ value ; } } | Add a result to the Results object . |
57,699 | public function getTagsArray ( ) { $ result = [ ] ; foreach ( $ this -> tags as $ tag ) { $ result [ ] = $ tag -> toArray ( ) ; } return $ result ; } | Return the array representation of the tags |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.