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 ) { $ sections [ $ section ] [ 'languages' ] = null ; } file_put_contents ( $ sectionsFile , Yaml :: dump ( $ sections ) ) ; }
|
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 directory "%s" not found.' , $ dictPath ) ) ; } if ( $ fileCallback && ! is_callable ( $ fileCallback ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The callback must be a callable, %s given.' , is_object ( $ fileCallback ) ? get_class ( $ fileCallback ) : gettype ( $ fileCallback ) ) ) ; } $ files = glob ( $ dictPath . '/*' ) ; foreach ( $ files as $ file ) { $ fileName = substr ( $ file , strlen ( $ dictPath ) + 1 ) ; if ( ! preg_match ( '/^(.+)\.(.+)$/' , $ fileName , $ tmp ) ) { throw new \ RuntimeException ( sprintf ( 'Could not parse language from file name "%s".' , $ fileName ) ) ; } $ lang = $ tmp [ 1 ] ; $ ext = $ tmp [ 2 ] ; if ( $ languages !== null && ! in_array ( $ lang , $ languages ) ) { continue ; } if ( 'php' == $ ext ) { $ words = include $ file ; } elseif ( in_array ( $ ext , array ( 'dict' , 'txt' ) ) ) { $ words = file ( $ file ) ; } else { throw new \ RuntimeException ( sprintf ( 'Undefined file with ext "%s". Supported "php" and "dict".' , $ ext ) ) ; } $ words = array_map ( 'trim' , $ words ) ; foreach ( $ words as $ wordLine ) { $ wordsLine = explode ( ' ' , $ wordLine ) ; $ wordsLine = array_map ( 'trim' , $ wordsLine ) ; foreach ( $ wordsLine as $ word ) { if ( ! $ word ) { continue ; } $ redisDictionary -> addWord ( $ lang , $ word ) ; } } if ( $ fileCallback ) { call_user_func ( $ fileCallback , $ file , count ( $ words ) ) ; } unset ( $ words ) ; gc_collect_cycles ( ) ; } }
|
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 -> TextLine ( '--' . $ boundary ) ; $ result .= sprintf ( "Content-Type: %s; charset=\"%s\"" , $ contentType , $ charSet ) ; $ result .= $ this -> LE ; $ result .= $ this -> HeaderLine ( 'Content-Transfer-Encoding' , $ encoding ) ; $ result .= $ this -> LE ; return $ result ; }
|
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_compare ( PHP_VERSION , '5.2.0' , '<' ) ) { $ magic_quotes = get_magic_quotes_runtime ( ) ; set_magic_quotes_runtime ( 0 ) ; } $ file_buffer = file_get_contents ( $ path ) ; $ file_buffer = $ this -> EncodeString ( $ file_buffer , $ encoding ) ; if ( version_compare ( PHP_VERSION , '5.2.0' , '<' ) ) { set_magic_quotes_runtime ( $ magic_quotes ) ; } return $ file_buffer ; } catch ( Exception $ e ) { $ this -> SetError ( $ e -> getMessage ( ) ) ; return '' ; } }
|
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 -> getRelativePath ( ) ) ; $ fullPath = $ this -> normalizePath ( $ destinationDirectory . DIRECTORY_SEPARATOR . $ file -> getRelativePathname ( ) ) ; if ( $ this -> shouldBeRemoved ( $ directoryPath ) ) { $ removedPaths [ ] = $ directoryPath ; $ this -> fileSystem -> deleteDirectory ( $ directoryPath , false ) ; } if ( $ this -> shouldBeRemoved ( $ fullPath ) ) { $ removedPaths [ ] = $ fullPath ; $ this -> fileSystem -> delete ( $ fullPath ) ; } } return $ removedPaths ; }
|
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 . $ path [ 'path' ] ; if ( ! $ this -> shouldBeIgnored ( $ path [ 'path' ] ) ) { if ( $ path [ 'type' ] == 'dir' ) { $ this -> fileSystem -> makeDirectory ( $ fullPath , 0755 , true , true ) ; } else { $ this -> fileSystem -> makeDirectory ( dirname ( $ fullPath ) , 0755 , true , true ) ; touch ( $ fullPath ) ; } $ generatedPaths [ $ pathKey ] = ( $ path + [ 'full' => $ fullPath ] ) ; } } $ this -> removeFilesAndDirectories ( $ destinationDirectory ) ; return $ generatedPaths ; }
|
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' ) ) ; if ( ! in_array ( $ ignoredPath , $ this -> automaticallyResolvedIgnoredPaths ) ) { $ this -> automaticallyResolvedIgnoredPaths [ ] = $ ignoredPath ; } } } $ this -> automaticallyResolvedIgnoredPaths [ ] = $ this -> normalizePath ( '_newup\*' ) ; }
|
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 false ; }
|
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_storage" config setting' ) ; } }
|
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 ( $ version === null and file_exists ( Config :: $ migration_directory . '/db_version' ) ) { $ version = [ 'project' => $ version_file ] ; file_put_contents ( Config :: $ migration_directory . '/db_version' , json_encode ( $ version ) ) ; } if ( empty ( $ version [ $ package ] ) ) { return null ; } return \ DateTime :: createFromFormat ( 'Ymd His' , $ version [ $ package ] ) ; }
|
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 ' . $ table ) ; } catch ( \ Exception $ e ) { $ db -> query ( ' CREATE TABLE `' . $ table . '` ( `package` varchar(32) NOT NULL, `version` datetime NOT NULL ); ' , [ ] ) ; $ all_packages = [ ] ; $ all_packages [ ] = 'project' ; foreach ( \ Skeleton \ Core \ Skeleton :: get_all ( ) as $ skeleton_package ) { $ all_packages [ ] = $ skeleton_package -> name ; } $ migrations = [ ] ; foreach ( $ all_packages as $ migration_package ) { $ version = self :: file_get_version ( $ migration_package ) ; if ( $ version !== null ) { self :: set_version ( $ migration_package , $ version ) ; } } } $ version = $ db -> get_one ( 'SELECT version FROM `' . $ table . '` WHERE package=?' , [ $ package ] ) ; if ( $ version === null ) { return null ; } return \ DateTime :: createFromFormat ( 'Y-m-d H:i:s' , $ version ) ; }
|
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 { throw new \ Exception ( 'Incorrect "version_storage" config setting' ) ; } }
|
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 ( $ version_file , true ) ; } else { $ versions = [ ] ; } $ versions [ $ package ] = $ version -> format ( 'Ymd His' ) ; file_put_contents ( Config :: $ migration_directory . '/db_version' , json_encode ( $ versions ) ) ; }
|
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 `' . $ table . '` WHERE package=?' , [ $ package ] ) ; if ( $ row === null ) { $ db -> insert ( $ table , $ data ) ; } else { $ db -> update ( $ table , $ data , 'package=' . $ db -> quote ( $ package ) ) ; } }
|
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 . '.' . $ 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 -> setContent ( $ output ) ; $ this -> send ( ) ; }
|
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 ( $ data ) ; $ this -> send ( ) ; }
|
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 $ this ; }
|
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 ( ) -> data ; $ this -> cell = array ( ) ; return $ this ; }
|
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_count < 5 || $ e_count > 6 ) throw new Exception ( $ e . " is not a valid cron expression" ) ; if ( $ e_count == 5 ) $ e_array [ ] = "*" ; } catch ( Exception $ e ) { throw $ e ; } return array ( $ s , $ e_array ) ; }
|
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' => $ table , 'map' => $ map , ] ; return $ this ; }
|
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 ) as $ dictionary ) { yield new DictionaryInformation ( $ dictionary , $ sourceLanguage , $ targetLanguage ) ; } yield new DictionaryInformation ( static :: ALL_TABLES , $ sourceLanguage , $ targetLanguage ) ; } } }
|
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 ( ) -> fetchAll ( \ PDO :: FETCH_ASSOC ) as $ root ) { $ language = $ root [ 'language' ] ; $ languages [ ] = $ language ; } return $ languages ; }
|
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 ) === '../' ) { $ path = $ path -> substring ( 3 ) ; $ folder = $ folder -> folder ( ) ; } return new self ( ( string ) $ folder . ( string ) $ path ) ; }
|
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=function(e){if(e&&3===e.length){var t=window,n=!(!t.document.createElementNS||!t.document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect||!document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1")||window.opera&&-1===navigator.userAgent.indexOf("Chrome")),o=function(o){var r=t.document.createElement("link"),a=t.document.getElementsByTagName("script")[0];r.rel="stylesheet",r.href=e[o&&n?0:o?1:2],a.parentNode.insertBefore(r,a)},r=new t.Image;r.onerror=function(){o(!1)},r.onload=function(){o(1===r.width&&1===r.height)},r.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="}};' ; foreach ( $ queue as $ wp_grunticon_options ) { echo $ wp_grunticon_options -> generate_javascript_markup ( ) ; array_push ( $ noscript , $ wp_grunticon_options -> generate_noscript_markup ( ) ) ; } echo '</script>' ; echo '<noscript>' ; echo implode ( PHP_EOL , $ noscript ) ; echo '</noscript>' ; } }
|
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 :: registerFile ( $ file ) ; } ) ; AnnotationRegistry :: registerAutoloadNamespaces ( $ this -> getAnnotationNamespaces ( ) ) ; $ annotationLoaders = ( array ) $ this -> getOption ( 'annotation_autoloaders' ) ; array_walk ( $ annotationLoaders , function ( $ autoLoader ) { AnnotationRegistry :: registerLoader ( $ autoLoader ) ; } ) ; }
|
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' , $ metadataMapping ) && $ metadataDriverChain -> getDefaultDriver ( ) !== null ) { throw new \ RuntimeException ( 'Only one default metadata mapping driver allowed, a namespace must be defined' ) ; } $ mappingDriver = $ this -> getMappingDriver ( $ metadataMapping ) ; if ( array_key_exists ( 'namespace' , $ metadataMapping ) ) { $ metadataDriverChain -> addDriver ( $ mappingDriver , $ metadataMapping [ 'namespace' ] ) ; } else { $ metadataDriverChain -> setDefaultDriver ( $ mappingDriver ) ; } } }
|
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 MappingDriver, "%s" given' , gettype ( $ mappingDriver ) ) ) ; } return $ mappingDriver ; } if ( count ( array_intersect ( [ 'type' , 'path' ] , array_keys ( $ metadataMapping ) ) ) === 2 ) { $ metadataMapping = array_merge ( [ 'extension' => null ] , $ metadataMapping ) ; return $ this -> getMappingDriverImplementation ( $ metadataMapping [ 'type' ] , ( array ) $ metadataMapping [ 'path' ] , $ metadataMapping [ 'extension' ] ) ; } throw new \ UnexpectedValueException ( 'metadata_mapping must be array with "driver" key or "type" and "path" keys' ) ; }
|
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 , $ extension ) ; case ManagerBuilder :: METADATA_MAPPING_YAML : return $ this -> getYamlMappingDriver ( $ paths , $ extension ) ; case ManagerBuilder :: METADATA_MAPPING_PHP : return $ this -> getPhpMappingDriver ( $ paths ) ; } throw new \ UnexpectedValueException ( sprintf ( '"%s" is not a valid metadata mapping type' , $ type ) ) ; }
|
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 -> $ element ( $ table , $ column ) ; } $ columns [ ] = $ sql ; } return $ columns ; }
|
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 ) . ' ' . $ columns ; }
|
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 ) { $ data = $ this -> buildMultipartContent ( $ params [ 'media_file' ] ) ; $ this -> setRequestBody ( $ data ) ; } else { $ this -> setRequestBody ( $ this -> formatQueryString ( $ params ) ) ; } curl_setopt ( $ curl , CURLOPT_POSTFIELDS , $ this -> getRequestBody ( ) ) ; } $ this -> buildHeaders ( $ method , $ url , $ params , $ multipart ) ; curl_setopt_array ( $ curl , [ CURLOPT_USERAGENT => $ this -> userAgent , CURLOPT_CONNECTTIMEOUT => 60 , CURLOPT_TIMEOUT => 20 , CURLOPT_RETURNTRANSFER => true , CURLOPT_URL => $ requestUrl , CURLOPT_SSL_VERIFYPEER => false , CURLOPT_HEADER => false , CURLINFO_HEADER_OUT => true , CURLOPT_HTTPHEADER => $ this -> getHeaders ( ) , ] ) ; $ response = new OAuthResponse ( ) ; $ response -> setResponse ( curl_exec ( $ curl ) ) ; $ response -> setCode ( curl_getinfo ( $ curl , CURLINFO_HTTP_CODE ) ) ; $ response -> setInfo ( curl_getinfo ( $ curl ) ) ; $ response -> setError ( curl_error ( $ curl ) ) ; $ response -> setErrno ( curl_errno ( $ curl ) ) ; curl_close ( $ curl ) ; return $ response ; }
|
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 ( $ callback ) ; }
|
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 :: fromXml ( $ message ) ; $ cost = $ xml -> getElementsByTagName ( 'renewalCost' ) ; $ static -> cost = StringLiteral :: fromXml ( $ cost ) ; return $ static ; }
|
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 -> close ( ) ; $ this -> response = null ; } $ this -> isStopping = false ; }
|
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, DELETE, PUT, PATCH, HEAD or OPTIONS' ) ; } }
|
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 ( $ var ) ; } } } }
|
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 ) ; return true ; }
|
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 ] ; $ a10 = - $ s * $ r [ 0 ] [ 0 ] + $ c * $ r [ 1 ] [ 0 ] ; $ a11 = - $ s * $ r [ 0 ] [ 1 ] + $ c * $ r [ 1 ] [ 1 ] ; $ a12 = - $ s * $ r [ 0 ] [ 2 ] + $ c * $ r [ 1 ] [ 2 ] ; $ r [ 0 ] [ 0 ] = $ a00 ; $ r [ 0 ] [ 1 ] = $ a01 ; $ r [ 0 ] [ 2 ] = $ a02 ; $ r [ 1 ] [ 0 ] = $ a10 ; $ r [ 1 ] [ 1 ] = $ a11 ; $ r [ 1 ] [ 2 ] = $ a12 ; return ; }
|
- - - - - - 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 ( ) ; $ data [ "logged_in" ] = ( bool ) $ current_user ; $ data [ "user_is_admin" ] = self :: isCurrentUserAdmin ( ) ; $ data [ "user_email" ] = self :: getCurrentUserEmail ( ) ; $ data [ "user_google_id" ] = $ current_user -> getUserId ( ) ; $ data [ "user_name" ] = $ current_user -> getNickname ( ) ; $ data [ "is_devserver" ] = Util :: isDevServer ( ) ; $ data [ "have_google_token" ] = false ; $ data [ "picture" ] = Util :: getGravatar ( $ data [ "user_email" ] ) ; if ( $ current_user ) { $ google_client = self :: getGoogleClientForCurrentUser ( ) ; $ token = $ google_client -> getAccessToken ( ) ; if ( $ token ) { $ data [ "have_google_token" ] = true ; } } return $ data ; }
|
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 -> getName ( ) ) ) ; return new Func ( $ this -> getName ( ) , [ $ this -> argument ] ) ; }
|
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 ( ) , $ this -> getFetchStyle ( ) ) ; $ this -> setData ( $ data ? : $ this -> getDefaultValue ( ) ) ; return $ this -> getData ( ) ; } catch ( NoRecordsAffectedException $ exc ) { throw $ exc ; } catch ( \ Exception $ exc ) { throw new ExecutionErrorException ( $ exc -> getMessage ( ) ) ; } }
|
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 ( $ language ) { Yii :: $ app -> language = $ language ; } else { Yii :: $ app -> language = Yii :: $ app -> sourceLanguage ; } }
|
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 -> getParamsRequirements ( ) , [ ] , '' , [ ] , $ route -> getMethods ( ) ) ; $ this -> syRouteCollection -> add ( $ route -> getName ( ) , $ syRoute ) ; } }
|
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.