idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
10,700
public function addExtension ( ExtensionInterface $ extension ) { if ( $ this -> initialized ) { throw new RuntimeException ( sprintf ( 'Unable to add extension "%s" as they have already been initialized.' , $ extension -> getName ( ) ) ) ; } $ this -> extensions [ $ extension -> getName ( ) ] = $ extension ; }
Adds an extension .
10,701
public function getAttribute ( $ object , $ name , array $ args = array ( ) , $ type = self :: ANY_CALL ) { if ( $ type == self :: ANY_CALL || $ type == self :: ARRAY_CALL ) { $ key = is_bool ( $ name ) || is_float ( $ name ) ? ( int ) $ name : $ name ; if ( ( is_array ( $ object ) && array_key_exists ( $ key , $ objec...
Gets an attribute value from an array or object .
10,702
public function escape ( $ value ) { if ( is_numeric ( $ value ) ) { return $ value ; } return is_string ( $ value ) ? htmlspecialchars ( $ value , ENT_QUOTES | ENT_SUBSTITUTE , $ this -> charset , false ) : $ value ; }
Escapes a html entities in a string .
10,703
protected function compile ( $ source , $ filename = null ) { $ tokens = $ this -> lexer -> tokenize ( $ source , $ filename ) ; $ source = $ this -> parser -> parse ( $ tokens , $ filename ) ; return $ source ; }
Compiles a template .
10,704
protected function initialize ( ) { foreach ( $ this -> extensions as $ extension ) { $ extension -> initialize ( $ this ) ; } $ this -> initialized = true ; }
Initializes the extensions .
10,705
protected function writeCacheFile ( $ file , $ content ) { $ dir = dirname ( $ file ) ; if ( ! is_dir ( $ dir ) ) { if ( false === @ mkdir ( $ dir , 0777 , true ) && ! is_dir ( $ dir ) ) { throw new RuntimeException ( "Unable to create the cache directory ($dir)." ) ; } } elseif ( ! is_writable ( $ dir ) ) { throw new ...
Writes cache file
10,706
public function setLanguage ( $ value ) { $ value = strtolower ( $ value ) ; if ( $ value == 'hiero' || $ value == 'phoenician' ) { $ this -> _language = $ value ; } return $ this ; }
Set the output language
10,707
public function onParseTemplate ( Template $ template ) : void { if ( strpos ( $ template -> getName ( ) , 'fe_' ) !== 0 ) { return ; } $ template -> bootstrapEnvironment = $ this -> environment ; }
Handle the parse template hook .
10,708
public function respond ( array $ data , $ total = null , $ page = null , $ per_page = null , $ status = 200 , $ headers = [ ] , $ options = 0 ) { $ response = [ 'status' => $ status , ] ; if ( ! is_null ( $ total ) ) { $ response [ 'total' ] = $ total ; } if ( ! is_null ( $ page ) ) { $ response [ 'page' ] = $ page ; ...
Format a response into an elegant api manager response .
10,709
public static function en2ar ( $ string , $ locale = 'en_US' ) { $ string = iconv ( "UTF-8" , "ASCII//TRANSLIT" , $ string ) ; $ string = preg_replace ( '/[^\w\s]/' , '' , $ string ) ; $ string = strtolower ( $ string ) ; $ words = explode ( ' ' , $ string ) ; $ string = '' ; foreach ( $ words as $ word ) { $ word = pr...
Transliterate English string into Arabic by render them in the orthography of the Arabic language
10,710
public function tokenize ( $ code , $ filename = null ) { if ( function_exists ( 'mb_internal_encoding' ) && ( ( int ) ini_get ( 'mbstring.func_overload' ) ) & 2 ) { $ encoding = mb_internal_encoding ( ) ; mb_internal_encoding ( 'ASCII' ) ; } $ this -> code = str_replace ( array ( "\r\n" , "\r" ) , "\n" , $ code ) ; $ ...
Gets the token stream from a template .
10,711
protected function lexData ( ) { if ( $ this -> position == count ( $ this -> positions [ 0 ] ) - 1 ) { $ this -> addCode ( substr ( $ this -> code , $ this -> cursor ) ) ; $ this -> cursor = $ this -> end ; return ; } $ position = $ this -> positions [ 0 ] [ ++ $ this -> position ] ; while ( $ position [ 1 ] < $ this ...
Lex data .
10,712
protected function lexOutput ( ) { if ( empty ( $ this -> brackets ) ) { $ this -> addCode ( ' ?>' ) ; $ this -> popState ( ) ; } else { $ this -> lexExpression ( ) ; } }
Lex output .
10,713
protected function lexDirective ( ) { if ( empty ( $ this -> brackets ) ) { $ this -> addCode ( ' ?>' ) ; $ this -> popState ( ) ; } else { $ this -> lexExpression ( ) ; } }
Lex directive .
10,714
protected function lexExpression ( ) { if ( preg_match ( self :: REGEX_STRING , $ this -> code , $ match , null , $ this -> cursor ) ) { $ this -> addCode ( $ match [ 0 ] ) ; $ this -> moveCursor ( $ match [ 0 ] ) ; } if ( strpos ( '([{' , $ this -> code [ $ this -> cursor ] ) !== false ) { $ this -> brackets [ ] = arr...
Lex expression .
10,715
protected function popState ( ) { if ( count ( $ this -> states ) === 0 ) { throw new RuntimeException ( 'Cannot pop state without a previous state' ) ; } $ this -> state = array_pop ( $ this -> states ) ; }
Pops the last state off the state stack .
10,716
private function setResponse ( $ response ) { $ xml = new \ SimpleXMLElement ( '<BaseResponse />' ) ; try { $ xml = new \ SimpleXMLElement ( $ response ) ; } catch ( \ Exception $ ex ) { } $ xml -> registerXPathNamespace ( 'xsi' , 'http://www.w3.org/2001/XMLSchema-instance' ) ; $ this -> response = $ xml ; }
Set the last response of an request
10,717
protected static function parseContents ( $ contents ) { $ fontParameters = $ contents [ 0 ] [ 1 ] ; $ font = new Font ( $ fontParameters [ 'name' ] , $ fontParameters [ 'color' ] , $ fontParameters [ 'size' ] , $ fontParameters [ 'style' ] ) ; unset ( $ contents [ 0 ] ) ; $ contentString = implode ( '' , array_map ( f...
Parse Contents .
10,718
protected function doAgain ( Migrator $ migrator , $ group ) { $ installed_migrations = $ migrator -> installedLatestMigrations ( ) ; $ installed_version = data_get ( $ installed_migrations , $ group . '.version' , Migrator :: VERSION_NULL ) ; $ definition_versions = $ migrator -> migrationVersionsByDesc ( $ group ) ; ...
Execute rollback and upgrade one version .
10,719
protected function checkInstalledVersion ( $ installed_version , array $ definition_versions ) { if ( $ installed_version === null ) { $ this -> error ( 'Nothing installed version.' ) ; $ this -> line ( 'Please run <comment>database:upgrade<comment>.' ) ; return false ; } $ index = array_search ( $ installed_version , ...
Check installed version .
10,720
public static function compress ( $ str ) { $ str = iconv ( 'utf-8' , 'cp1256' , $ str ) ; $ bits = self :: str2bits ( $ str ) ; $ hex = self :: bits2hex ( $ bits ) ; $ bin = pack ( 'h*' , $ hex ) ; return $ bin ; }
Compress the given string using the Huffman - like coding
10,721
public static function decompress ( $ bin ) { $ temp = unpack ( 'h*' , $ bin ) ; $ bytes = $ temp [ 1 ] ; $ bits = self :: hex2bits ( $ bytes ) ; $ str = self :: bits2str ( $ bits ) ; $ str = iconv ( 'cp1256' , 'utf-8' , $ str ) ; return $ str ; }
Uncompress a compressed string
10,722
public static function search ( $ bin , $ word ) { $ word = iconv ( 'utf-8' , 'cp1256' , $ word ) ; $ wBits = self :: str2bits ( $ word ) ; $ temp = unpack ( 'h*' , $ bin ) ; $ bytes = $ temp [ 1 ] ; $ bits = self :: hex2bits ( $ bytes ) ; if ( strpos ( $ bits , $ wBits ) ) { return true ; } else { return false ; } }
Search a compressed string for a given word
10,723
public static function length ( $ bin ) { $ temp = unpack ( 'h*' , $ bin ) ; $ bytes = $ temp [ 1 ] ; $ bits = self :: hex2bits ( $ bytes ) ; $ count = 0 ; $ i = 0 ; while ( isset ( $ bits [ $ i ] ) ) { $ count ++ ; if ( $ bits [ $ i ] == 1 ) { $ i += 9 ; } else { $ i += 4 ; } } return $ count ; }
Retrieve the original string length
10,724
protected static function str2bits ( $ str ) { $ bits = '' ; $ total = strlen ( $ str ) ; $ i = - 1 ; while ( ++ $ i < $ total ) { $ char = $ str [ $ i ] ; $ pos = strpos ( self :: $ _encode , $ char ) ; if ( $ pos !== false ) { $ bits .= substr ( self :: $ _binary , $ pos * 5 , 4 ) ; } else { $ int = ord ( $ char ) ; ...
Convert textual string into binary string
10,725
protected static function bits2str ( $ bits ) { $ str = '' ; while ( $ bits ) { $ flag = substr ( $ bits , 0 , 1 ) ; $ bits = substr ( $ bits , 1 ) ; if ( $ flag == 1 ) { $ byte = substr ( $ bits , 0 , 8 ) ; $ bits = substr ( $ bits , 8 ) ; if ( $ bits || strlen ( $ code ) == 8 ) { $ int = base_convert ( $ byte , 2 , 1...
Convert binary string into textual string
10,726
protected static function bits2hex ( $ bits ) { $ hex = '' ; $ total = strlen ( $ bits ) / 4 ; for ( $ i = 0 ; $ i < $ total ; $ i ++ ) { $ nibbel = substr ( $ bits , $ i * 4 , 4 ) ; $ pos = strpos ( self :: $ _bin , $ nibbel ) ; $ hex .= substr ( self :: $ _hex , $ pos / 5 , 1 ) ; } return $ hex ; }
Convert binary string into hexadecimal string
10,727
protected static function hex2bits ( $ hex ) { $ bits = '' ; $ total = strlen ( $ hex ) ; for ( $ i = 0 ; $ i < $ total ; $ i ++ ) { $ pos = strpos ( self :: $ _hex , $ hex [ $ i ] ) ; $ bits .= substr ( self :: $ _bin , $ pos * 5 , 4 ) ; } return $ bits ; }
Convert hexadecimal string into binary string
10,728
public function get ( $ page = 1 , $ limit = 25 , $ lastSynch = null ) { return $ this -> client -> call ( "sales_invoices" , [ 'page' => $ page , 'per_page' => $ limit , 'last_synch' => $ lastSynch , ] , 'GET' ) ; }
Retrieve all sales invoices with pagination .
10,729
public function parse ( $ pattern , array $ conditions ) { if ( strlen ( $ pattern ) > 1 && $ pattern [ 0 ] !== '/' ) { throw new InvalidRoutePatternException ( sprintf ( 'Invalid route pattern: non-root route must be prefixed with \'/\', \'%s\' given' , $ pattern ) ) ; } $ segments = [ ] ; $ patternSegments = explode ...
Parses the supplied route pattern into an array of route segments .
10,730
private function mustRedirect ( ServerRequestInterface $ request ) : bool { if ( $ this -> redirect === false ) { return false ; } return ! $ this -> checkHttpsForward || ( $ request -> getHeaderLine ( 'X-Forwarded-Proto' ) !== 'https' && $ request -> getHeaderLine ( 'X-Forwarded-Port' ) !== '443' ) ; }
Check whether the request must be redirected or not .
10,731
public static function arCreateFromFormat ( $ format , $ date , $ tz = null , $ correction = null ) { $ arDate = self :: parseDateFormat ( $ format , $ date ) ; return self :: arCreate ( $ arDate [ 'arYear' ] , $ arDate [ 'arMonth' ] , $ arDate [ 'arDay' ] , $ arDate [ 'hour' ] , $ arDate [ 'minute' ] , $ arDate [ 'sec...
Create new instance from Hijri date in the format provided .
10,732
private function setTodayHijriDate ( ) { $ today = $ this -> convertTodayToHijri ( ) ; $ this -> arYear = ( int ) $ today [ 'arYear' ] ; $ this -> arMonth = ( int ) $ today [ 'arMonth' ] ; $ this -> arDay = ( int ) $ today [ 'arDay' ] ; }
Set the instance Hijri date for today .
10,733
protected function hijriToTimestamp ( $ arYear , $ arMonth , $ arDay , $ hour = null , $ minute = null , $ second = null , $ correction = 0 ) { $ hour = isset ( $ hour ) ? $ hour : date ( 'H' ) ; $ minute = isset ( $ minute ) ? $ minute : date ( 'i' ) ; $ second = isset ( $ second ) ? $ second : date ( 's' ) ; return (...
Convert given Hijri date to Gregorian Date in timestamp
10,734
private function convertTodayToHijri ( ) { list ( $ arYear , $ arMonth , $ arDay ) = ( new Date ( ) ) -> hjConvert ( date ( 'Y' ) , date ( 'm' ) , date ( 'd' ) ) ; return [ 'arYear' => $ arYear , 'arMonth' => $ arMonth , 'arDay' => $ arDay , ] ; }
Convert Toady s Gregorian date to Hijri date .
10,735
private function updateHijriDate ( $ arYear , $ arMonth , $ arDay ) { $ this -> arYear = $ arYear ; $ this -> arMonth = $ arMonth ; $ this -> arDay = $ arDay ; }
Update the instance Hijri Date used by static create methods .
10,736
public function getTwitterTokened ( $ token , $ secret ) { return new TwitterOAuth ( $ this -> consumer_key , $ this -> consumer_secret , $ token , $ secret ) ; }
Use this for after we have a token and a secret for the use . ( you must save these in order for them to be usefull
10,737
function getAccessToken ( $ oauth_verifier = FALSE ) { $ parameters = [ ] ; if ( ! empty ( $ oauth_verifier ) ) { $ parameters [ 'oauth_verifier' ] = $ oauth_verifier ; } $ request = $ this -> oAuthRequest ( $ this -> accessTokenURL ( ) , 'GET' , $ parameters ) ; $ token = OAuthUtil :: parse_parameters ( $ request ) ; ...
Exchange request token and secret for an access token and secret to sign API calls .
10,738
function getHeader ( $ ch , $ header ) { $ i = strpos ( $ header , ':' ) ; if ( ! empty ( $ i ) ) { $ key = str_replace ( '-' , '_' , strtolower ( substr ( $ header , 0 , $ i ) ) ) ; $ value = trim ( substr ( $ header , $ i + 2 ) ) ; $ this -> http_header [ $ key ] = $ value ; } return strlen ( $ header ) ; }
Get the header info to store .
10,739
public function loadExtra ( ) { $ extra_words = file ( __DIR__ . '/data/ar-extra-stopwords.txt' ) ; $ extra_words = array_map ( 'trim' , $ extra_words ) ; $ this -> _commonWords = array_merge ( $ this -> _commonWords , $ extra_words ) ; }
Load enhanced Arabic stop words list
10,740
protected function minAcceptedRank ( $ str , $ arr , $ int , $ max ) { $ len = array ( ) ; foreach ( $ str as $ line ) { $ len [ ] = mb_strlen ( $ line ) ; } rsort ( $ arr , SORT_NUMERIC ) ; $ totalChars = 0 ; for ( $ i = 0 ; $ i <= $ int ; $ i ++ ) { if ( ! isset ( $ arr [ $ i ] ) ) { $ minRank = 0 ; break ; } $ total...
Calculate minimum rank for sentences which will be including in the summary
10,741
protected function getMatchHash ( ) { $ hashes = [ ] ; foreach ( $ this -> matchers as $ matcher ) { $ hashes [ ] = $ matcher -> getHash ( ) ; } return implode ( '::' , $ hashes ) ; }
Returns a unique hash for the matching criteria of the segment .
10,742
protected function buildAttributes ( $ options , $ classes ) { $ attributes = [ ] ; $ attributes [ ] = 'class="' . $ classes . '"' ; unset ( $ options [ 'class' ] ) ; if ( is_array ( $ options ) ) { foreach ( $ options as $ attribute => $ value ) { $ attributes [ ] = $ this -> createAttribute ( $ attribute , $ value ) ...
Build the attribute list to add to the icon we are about to generate .
10,743
public function setScopes ( array $ scopes = null ) { ValidationUtility :: ensureNullOrArrayOfType ( '$scopes' , $ scopes , __NAMESPACE__ . '\Scope' ) ; $ this -> scopes = $ scopes ; return $ this ; }
Set the scopes which the client application requested by the scope request parameter .
10,744
public function setUiLocales ( array $ uiLocales = null ) { ValidationUtility :: ensureNullOrArrayOfString ( '$uiLocales' , $ uiLocales ) ; $ this -> uiLocales = $ uiLocales ; return $ this ; }
Set the list of preferred languages and scripts for the user interface .
10,745
public function setClaimsLocales ( array $ claimsLocales = null ) { ValidationUtility :: ensureNullOrArrayOfString ( '$claimsLocales' , $ claimsLocales ) ; $ this -> claimsLocales = $ claimsLocales ; return $ this ; }
Set the list of preferred languages and scripts for claim values contained in an ID token .
10,746
public function setPrompts ( array $ prompts = null ) { ValidationUtility :: ensureNullOrArrayOfType ( '$prompts' , $ prompts , '\Authlete\Types\Prompt' ) ; $ this -> prompts = $ prompts ; return $ this ; }
Set the list of prompts contained in the authorization request .
10,747
public function monthly ( $ year , $ month , $ page = 1 , $ limit = 25 ) { return $ this -> client -> call ( "expenses/in_month/{$year}/{$month}" , [ 'page' => $ page , 'per_page' => $ limit ] , 'GET' ) ; }
Retrieve all expenses by pagination with spesific month of the year .
10,748
public function stripTashkeel ( $ text ) { $ tashkeel = array ( $ this -> _chars [ 'FATHATAN' ] , $ this -> _chars [ 'DAMMATAN' ] , $ this -> _chars [ 'KASRATAN' ] , $ this -> _chars [ 'FATHA' ] , $ this -> _chars [ 'DAMMA' ] , $ this -> _chars [ 'KASRA' ] , $ this -> _chars [ 'SUKUN' ] , $ this -> _chars [ 'SHADDA' ] ...
Strip all tashkeel characters from an Arabic text .
10,749
public function normaliseHamza ( $ text ) { $ replace = array ( $ this -> _chars [ 'WAW_HAMZA' ] => $ this -> _chars [ 'WAW' ] , $ this -> _chars [ 'YEH_HAMZA' ] => $ this -> _chars [ 'YEH' ] , ) ; $ alephs = array ( $ this -> _chars [ 'ALEF_MADDA' ] , $ this -> _chars [ 'ALEF_HAMZA_ABOVE' ] , $ this -> _chars [ 'ALEF_...
Normalise all Hamza characters to their corresponding aleph character in an Arabic text .
10,750
public function normaliseLamaleph ( $ text ) { $ text = str_replace ( $ this -> _chars [ 'LAM_ALEPH' ] , $ simple_LAM_ALEPH , $ text ) ; $ text = str_replace ( $ this -> _chars [ 'LAM_ALEPH_HAMZA_ABOVE' ] , $ simple_LAM_ALEPH_HAMZA_ABOVE , $ text ) ; $ text = str_replace ( $ this -> _chars [ 'LAM_ALEPH_HAMZA_BELOW' ] ,...
Unicode uses some special characters where the lamaleph and any hamza above them are combined into one code point . Some input system use them . This function expands these characters .
10,751
public function normalise ( $ text ) { $ text = $ this -> stripTashkeel ( $ text ) ; $ text = $ this -> stripTatweel ( $ text ) ; $ text = $ this -> normaliseHamza ( $ text ) ; return $ text ; }
Takes a string it applies the various filters in this class to return a unicode normalised string suitable for activities such as searching indexing etc .
10,752
public function utf8Strrev ( $ str , $ reverse_numbers = false ) { preg_match_all ( '/./us' , $ str , $ ar ) ; if ( $ reverse_numbers ) { return join ( '' , array_reverse ( $ ar [ 0 ] ) ) ; } else { $ temp = array ( ) ; foreach ( $ ar [ 0 ] as $ value ) { if ( is_numeric ( $ value ) && ! empty ( $ temp [ 0 ] ) && is_nu...
Take a UTF8 string and reverse it .
10,753
public function charName ( $ archar ) { $ key = array_search ( $ archar , $ this -> _chars ) ; $ name = $ this -> _charArNames [ "$key" ] ; return $ name ; }
Return Arabic letter name in arabic .
10,754
public function a4MaxChars ( $ font ) { $ x = 381.6 - 31.57 * $ font + 1.182 * pow ( $ font , 2 ) - 0.02052 * pow ( $ font , 3 ) + 0.0001342 * pow ( $ font , 4 ) ; return floor ( $ x - 2 ) ; }
Regression analysis calculate roughly the max number of character fit in one A4 page line for a given font size .
10,755
public function a4Lines ( $ str , $ font ) { $ str = str_replace ( array ( "\r\n" , "\n" , "\r" ) , "\n" , $ str ) ; $ lines = 0 ; $ chars = 0 ; $ words = explode ( ' ' , $ str ) ; $ w_count = count ( $ words ) ; $ max_chars = $ this -> a4MaxChars ( $ font ) ; for ( $ i = 0 ; $ i < $ w_count ; $ i ++ ) { $ w_len = mb_s...
Calculate the lines number of given Arabic text and font size that will fit in A4 page size
10,756
protected function decodeEntities2 ( $ prefix , $ codepoint , $ original , & $ table , & $ exclude ) { if ( ! $ prefix ) { if ( isset ( $ table [ $ original ] ) ) { return $ table [ $ original ] ; } else { return $ original ; } } if ( $ prefix == '#x' ) { $ codepoint = base_convert ( $ codepoint , 16 , 10 ) ; } if ( $ ...
Helper function for decodeEntities
10,757
public static function stringToDOMDocument ( $ xml , $ filename = '' ) { $ preUseInternalErrors = libxml_use_internal_errors ( true ) ; try { libxml_clear_errors ( ) ; $ doc = new DOMDocument ( ) ; if ( @ $ doc -> loadXML ( $ xml ) === false ) { throw new Exception ( empty ( $ filename ) ? 'Failed to parse xml' : ( 'Fa...
Convert a string containing xml code to a DOMDocument .
10,758
public static function explainLibXmlErrors ( $ filename = '' ) { $ errors = libxml_get_errors ( ) ; $ result = array ( ) ; if ( empty ( $ errors ) ) { $ result [ ] = 'Unknown libxml error' ; } else { foreach ( $ errors as $ error ) { switch ( $ error -> level ) { case LIBXML_ERR_WARNING : $ level = 'Warning' ; break ; ...
Explain the libxml errors encountered .
10,759
static public function handle ( $ child ) { $ _instances = 'empty' ; $ id = '' ; $ element = '' ; if ( in_array ( $ child -> getName ( ) , [ 'iq' , 'presence' , 'message' ] ) ) { $ id = ( string ) $ child -> attributes ( ) -> id ; } $ sess = Session :: start ( ) ; if ( ( $ id != '' && $ sess -> get ( $ id ) == false ) ...
Constructor of class Handler .
10,760
public function setEmbedClass ( $ class ) { $ classes = ( $ class ) ? explode ( ' ' , $ class ) : [ ] ; foreach ( $ classes as $ key => $ value ) { $ this -> classes [ $ value ] = $ value ; } return $ this -> owner ; }
Set CSS classes for templates
10,761
public function getEmbed ( ) { $ owner = $ this -> owner ; $ title = $ owner -> EmbedTitle ; $ class = $ owner -> EmbedClass ; $ type = $ owner -> EmbedType ; $ template = $ this -> template ; $ embedHTML = $ owner -> EmbedHTML ; $ sourceURL = $ owner -> EmbedSourceURL ; $ templates = [ ] ; if ( $ type ) { $ templates ...
Renders embed into appropriate template HTML
10,762
public function setRedirectUris ( array $ redirectUris = null ) { ValidationUtility :: ensureNullOrArrayOfString ( '$redirectUris' , $ redirectUris ) ; $ this -> redirectUris = $ redirectUris ; return $ this ; }
Set the redirect URIs .
10,763
public function setResponseTypes ( array $ responseTypes = null ) { ValidationUtility :: ensureNullOrArrayOfType ( '$responseTypes' , $ responseTypes , '\Authlete\Types\ResponseType' ) ; $ this -> responseTypes = $ responseTypes ; return $ this ; }
Set the response_type values that this client application is declaring that it will restrict itself to using .
10,764
public function setGrantTypes ( array $ grantTypes = null ) { ValidationUtility :: ensureNullOrArrayOfType ( '$grantTypes' , $ grantTypes , '\Authlete\Types\GrantType' ) ; $ this -> grantTypes = $ grantTypes ; return $ this ; }
Set the grant_type values that this client application is declaring that it will restrict itself to using .
10,765
public function setContacts ( array $ contacts = null ) { ValidationUtility :: ensureNullOrArrayOfString ( '$contacts' , $ contacts ) ; $ this -> contacts = $ contacts ; return $ this ; }
Set the email addresses of contacts for this client application .
10,766
public function setClientNames ( array $ clientNames = null ) { ValidationUtility :: ensureNullOrArrayOfType ( '$clientNames' , $ clientNames , __NAMESPACE__ . '\TaggedValue' ) ; $ this -> clientNames = $ clientNames ; return $ this ; }
Set the localized names of this client application .
10,767
public function setLogoUris ( array $ logoUris = null ) { ValidationUtility :: ensureNullOrArrayOfType ( '$logoUris' , $ logoUris , __NAMESPACE__ . '\TaggedValue' ) ; $ this -> logoUris = $ logoUris ; return $ this ; }
Set the URIs of localized logo images of this client application .
10,768
public function setClientUris ( array $ clientUris = null ) { ValidationUtility :: ensureNullOrArrayOfType ( '$clientUris' , $ clientUris , __NAMESPACE__ . '\TaggedValue' ) ; $ this -> clientUris = $ clientUris ; return $ this ; }
Set the URIs of localized home pages of this client application .
10,769
public function setPolicyUris ( array $ policyUris = null ) { ValidationUtility :: ensureNullOrArrayOfType ( '$policyUris' , $ policyUris , __NAMESPACE__ . '\TaggedValue' ) ; $ this -> policyUris = $ policyUris ; return $ this ; }
Set the URIs of localized policy pages of this client application .
10,770
public function setTosUris ( array $ tosUris = null ) { ValidationUtility :: ensureNullOrArrayOfType ( '$tosUris' , $ tosUris , __NAMESPACE__ . '\TaggedValue' ) ; $ this -> tosUris = $ tosUris ; return $ this ; }
Set the URIs of localized Terms Of Service pages of this client application .
10,771
public function setDefaultAcrs ( array $ defaultAcrs = null ) { ValidationUtility :: ensureNullOrArrayOfString ( '$defaultAcrs' , $ defaultAcrs ) ; $ this -> defaultAcrs = $ defaultAcrs ; return $ this ; }
Set the default list of Authentication Context Class References .
10,772
public function setRequestUris ( array $ requestUris = null ) { ValidationUtility :: ensureNullOrArrayOfString ( '$requestUris' , $ requestUris ) ; $ this -> requestUris = $ requestUris ; return $ this ; }
Set the request URIs that this client declares it may use .
10,773
public function setClients ( array $ clients = null ) { ValidationUtility :: ensureNullOrArrayOfType ( '$clients' , $ clients , __NAMESPACE__ . '\Client' ) ; $ this -> clients = $ clients ; return $ this ; }
Set the list of client applications that match the query conditions .
10,774
protected function arabicMonths ( $ mode ) { $ replacements = array ( ) ; foreach ( $ this -> _xml -> xpath ( "//ar_month/mode[@id=$mode]/replace" ) as $ month ) { array_push ( $ replacements , ( string ) $ month ) ; } return $ replacements ; }
Add Arabic month names to the replacement array
10,775
public function hjConvert ( $ Y , $ M , $ D ) { if ( function_exists ( 'GregorianToJD' ) ) { $ jd = GregorianToJD ( $ M , $ D , $ Y ) ; } else { $ jd = $ this -> gregToJd ( $ M , $ D , $ Y ) ; } list ( $ year , $ month , $ day ) = $ this -> jdToIslamic ( $ jd ) ; return array ( $ year , $ month , $ day ) ; }
Convert given Gregorian date into Hijri date
10,776
protected function jdToIslamic ( $ jd ) { $ l = ( int ) $ jd - 1948440 + 10632 ; $ n = ( int ) ( ( $ l - 1 ) / 10631 ) ; $ l = $ l - 10631 * $ n + 354 ; $ j = ( int ) ( ( 10985 - $ l ) / 5316 ) * ( int ) ( ( 50 * $ l ) / 17719 ) + ( int ) ( $ l / 5670 ) * ( int ) ( ( 43 * $ l ) / 15238 ) ; $ l = $ l - ( int ) ( ( 30 - ...
Convert given Julian day into Hijri date
10,777
protected function gregToJd ( $ m , $ d , $ y ) { if ( $ m < 3 ) { $ y -- ; $ m += 12 ; } if ( ( $ y < 1582 ) || ( $ y == 1582 && $ m < 10 ) || ( $ y == 1582 && $ m == 10 && $ d <= 15 ) ) { $ b = 0 ; } else { $ a = ( int ) ( $ y / 100 ) ; $ b = 2 - $ a + ( int ) ( $ a / 4 ) ; } $ jd = ( int ) ( 365.25 * ( $ y + 4716 ) ...
Converts a Gregorian date to Julian Day Count
10,778
public static function cacheFlush ( ) { foreach ( self :: getCategories ( ) as $ category ) { foreach ( Yii :: $ app -> i18n -> languages as $ language ) { Yii :: $ app -> cache -> delete ( [ 'yii\i18n\DbMessageSource' , $ category , $ language , ] ) ; } } return true ; }
Deletes all translations values from cache .
10,779
protected function tokensEqual ( $ a , $ b ) { if ( is_string ( $ a ) && is_string ( $ b ) ) { return $ a === $ b ; } elseif ( isset ( $ a [ 0 ] , $ a [ 1 ] , $ b [ 0 ] , $ b [ 1 ] ) ) { return $ a [ 0 ] === $ b [ 0 ] && $ a [ 1 ] == $ b [ 1 ] ; } return false ; }
Finds out if two PHP tokens are equal
10,780
public function delete ( $ key ) { if ( strpos ( $ key , '*' ) !== false ) { $ this -> deleteGlob ( $ key ) ; } else { $ this -> client -> del ( [ $ key ] ) ; } }
Deletes a cache entry
10,781
protected function logInvoking ( Invocation $ invocation , Result $ result , $ time = null ) { Log :: channel ( 'homer' ) -> debug ( sprintf ( '%s %5.2fms %s->%s' , $ result -> hasException ( ) ? 'Success' : 'Failure' , $ time , $ invocation -> getInterface ( ) , $ invocation -> getMethod ( ) ) , [ 'during' => $ time ,...
Log the invocation .
10,782
public function replaceHints ( ) { foreach ( $ this -> hints as $ namespace => $ path ) { $ path = $ this -> getLangPath ( $ namespace ) ; if ( ! is_dir ( $ path ) ) { continue ; } $ this -> hints [ $ namespace ] = $ path ; } return ; }
Replace hints after publishing translations
10,783
public function addPublishedNamespace ( $ namespace , $ hint ) { $ path = $ this -> getLangPath ( $ namespace ) ; return ( is_dir ( $ path ) ) ? $ this -> hints [ $ namespace ] = $ path : $ this -> addNamespace ( $ namespace , $ hint ) ; }
Adds published namespace path to hints container
10,784
protected function registerServerSockets ( ) { $ this -> app -> afterResolving ( ServerFactory :: class , function ( $ factory ) { $ factory -> extendServerSocket ( 'whisper' , function ( $ app , $ config ) { return new WhisperServerSocket ( $ app , $ config ) ; } ) ; } ) ; }
Register all extension socket protocols .
10,785
protected function registerHomer ( ) { $ this -> app -> singleton ( 'homer' , function ( $ app ) { return new HomerManager ( $ app , $ app [ 'homer.context' ] , $ app [ 'homer.dispatcher' ] , $ app [ 'config' ] [ 'homer' ] ) ; } ) ; }
Register the Homer manager .
10,786
protected function resolveExtensionName ( $ path ) { preg_match ( "/src(.*?)src/" , dirname ( $ path ) , $ match ) ; if ( ! isset ( $ match [ 1 ] ) ) { throw new \ Exception ( 'Unable to resolve valid module path' ) ; } $ name = trim ( $ match [ 1 ] , DIRECTORY_SEPARATOR ) ; if ( ! starts_with ( $ name , [ 'components'...
resolving extension name by realpath
10,787
protected function toArray ( $ data ) { if ( is_object ( $ data ) ) { $ data = ( array ) $ data ; } if ( is_array ( $ data ) ) { foreach ( $ data as $ key => $ val ) { $ data [ $ key ] = $ this -> toArray ( $ val ) ; } } return $ data ; }
Converts recursively all objects to arrays Used eg . when making soap calls and returning results to templates which like arrays better than StdClass
10,788
public function request ( $ resourceUrl , array $ params = array ( ) ) { $ params = array ( 'url' => $ resourceUrl ) + $ params ; $ url = $ this -> setUrlParams ( $ this -> endpoint , $ params ) ; $ data = $ this -> fetchUrl ( $ url ) ; if ( self :: TYPE_JSON === $ this -> type ) { return $ this -> createResponseFromJs...
Requests the provider
10,789
public function createResponseFromXml ( $ xml ) { $ dom = new \ DomDocument ( $ xml ) ; if ( ! $ dom -> loadXML ( $ xml ) ) { return ; } $ data = array ( ) ; foreach ( $ dom -> childNodes as $ root ) { if ( $ root -> nodeType !== XML_ELEMENT_NODE ) { continue ; } foreach ( $ root -> childNodes as $ node ) { $ name = $ ...
Creates a response from a XML string
10,790
protected function refreshApplication ( ) { if ( ! $ this -> foundation -> installed ( ) ) { return ; } $ this -> call ( 'extension:detect' , [ '--quiet' => true ] ) ; $ extensions = $ this -> memory -> get ( 'extensions.active' , [ ] ) ; try { foreach ( $ extensions as $ extension => $ config ) { $ options = [ 'name' ...
Refresh application for Antares .
10,791
protected function optimizeApplication ( ) { $ this -> call ( 'config:clear' ) ; $ this -> call ( 'route:clear' ) ; $ this -> call ( 'clear-compiled' ) ; if ( $ this -> laravel -> environment ( 'production' ) && ! $ this -> option ( 'no-cache' ) ) { $ this -> call ( 'config:cache' ) ; $ this -> call ( 'route:cache' ) ;...
Optimize application for Antares .
10,792
public function compose ( $ classname ) { if ( ! class_exists ( $ classname ) ) { return false ; } $ instance = $ this -> app -> make ( $ classname ) ; $ params = $ instance -> getAttribute ( 'boot' ) ; $ group = array_get ( $ params , 'group' ) ; $ this -> app -> instance ( $ group , app ( 'antares.widget' ) -> make (...
listening on compose event and attaches menu
10,793
protected function content ( array $ params = [ ] ) { $ resultView = array_get ( $ params , 'view' , $ this -> defaultOptions [ 'view' ] ) ; if ( ! view ( ) -> exists ( $ resultView ) ) { return false ; } return $ this -> app -> make ( 'antares.widget' ) -> make ( array_get ( $ params , 'pane' , $ this -> defaultOption...
creates content of menu widget
10,794
public function transform ( array $ elasticaObjects ) { $ results = array ( ) ; foreach ( $ elasticaObjects as $ elasticaObject ) { $ elasticaObject = $ elasticaObject -> getHit ( ) ; $ obj = new $ this -> objectClass ( ) ; $ obj -> setId ( $ elasticaObject [ '_id' ] ) ; foreach ( $ elasticaObject [ '_source' ] as $ at...
Transforms an array of elastica objects into an array of model objects
10,795
public function forceEditable ( ) { array_set ( $ this -> attributes , 'force_editable' , true ) ; array_set ( $ this -> attributes , 'force_displayable' , true ) ; return $ this ; }
force edit field
10,796
public function block ( array $ blockAttrs = [ ] ) { $ this -> block = array_merge ( array_get ( $ this -> attributes , 'block' , [ ] ) , $ blockAttrs ) ; return $ this ; }
Sets block attributes
10,797
public function getBlock ( $ key , $ default = null ) { if ( ! isset ( $ this -> attributes [ 'block' ] ) ) { return $ default ; } if ( ! is_null ( $ key ) && ! array_key_exists ( $ key , $ this -> attributes [ 'block' ] ) ) { return $ default ; } if ( is_null ( $ key ) ) { return $ this -> attributes [ 'block' ] ; } i...
Gets block attributes
10,798
protected function bootMemoryEvent ( ) { $ app = $ this -> app ; $ app -> make ( 'events' ) -> listen ( Form :: class , function ( Form $ event ) use ( $ app ) { $ app -> make ( 'antares.memory' ) -> make ( 'registry.forms' ) -> put ( 'forms' , $ event -> formName ) ; } ) ; $ app -> terminating ( function ( ) use ( $ a...
Register memory events during booting .
10,799
public function boot ( ) { if ( $ this -> booted ) { return ; } $ this -> booted = true ; $ this -> resolveServices ( ) ; $ this -> resolveReferences ( ) ; }
Boot the Homer .