idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
47,100
public function GetXX ( $ number_str , $ modifer ) { $ number_int = intval ( $ number_str ) ; if ( $ number_int >= 0 && $ number_int < 100 ) { if ( array_key_exists ( $ number_int , $ this -> words -> xx ) ) { return $ this -> words -> xx [ $ number_int ] ; } else { throw new Exception ( 'xx: Array index (' . $ number_...
Pass in a number that is inclusively between 0 and 99 and it will return the corresponding words .
47,101
public function send ( $ output , OutputStrategyInterface $ outputStrategy = null ) { if ( ! ( $ outputStrategy instanceof OutputStrategyInterface ) ) { $ outputStrategy = $ this -> defaultOutputStrategy ; } $ contentType = new Header ( Header :: CONTENT_TYPE , $ outputStrategy -> getMime ( ) ) ; $ this -> header ( $ c...
Send the given output using the given or default output strategy .
47,102
public function sendFile ( $ src ) { $ pointer = fopen ( $ src , 'r' ) ; if ( ! is_resource ( $ pointer ) ) { throw new RuntimeException ( "Unable to load '$src' for sending." ) ; } $ result = fpassthru ( $ pointer ) ; fclose ( $ pointer ) ; return $ result ; }
Directly output results from a file . This bypasses the output strategy altogether .
47,103
public function divide ( $ number ) { if ( Number :: isZero ( $ number ) ) { throw new DivisionByZeroException ; } $ this -> number = $ this -> number / $ number ; return $ this ; }
Divide a value
47,104
public function round ( $ precision = 0 , $ mode = PHP_ROUND_HALF_UP ) { $ this -> number = round ( $ this -> number , $ precision , $ mode ) ; return $ this ; }
Round the value
47,105
public function toTheN ( $ number ) { for ( $ i = 1 ; $ i <= $ number ; $ i ++ ) { $ this -> multiply ( $ this -> number ) ; } return $ this ; }
To the n expression
47,106
public function transform ( $ dateTime ) : ? int { if ( null === $ dateTime ) { return null ; } if ( ! $ dateTime instanceof \ DateTimeInterface ) { throw new TransformationFailedException ( 'Expected a \DateTimeInterface.' ) ; } return $ dateTime -> getTimestamp ( ) ; }
Transforms a DateTime object into a timestamp in the configured timezone .
47,107
public function getData ( ) { if ( $ this -> cacheProvider !== null && $ this -> cacheProvider -> contains ( 'routerCache' ) ) { return $ this -> cacheProvider -> fetch ( 'routerCache' ) ; } return parent :: getData ( ) ; }
Returns the collected route data as provided by the data generator .
47,108
public static function checkUpdate ( $ request , $ object ) { $ repo = new Tenant_Views_SpaRepository ( ) ; $ spa = $ repo -> get ( new Pluf_HTTP_Request ( '/' ) , array ( 'modelId' => $ object -> name ) ) ; $ object -> last_version = $ spa -> version ; $ object -> update ( ) ; return $ object ; }
Check update of an spa
47,109
public static function update ( $ request , $ object ) { $ backend = Pluf :: f ( 'marketplace.backend' , 'http://marketplace.webpich.com' ) ; $ path = '/api/v2/marketplace/spas/' . $ object -> name . '/file' ; $ file = Pluf :: f ( 'temp_folder' , '/tmp' ) . '/spa-' . rand ( ) ; $ client = new GuzzleHttp \ Client ( ) ; ...
Update an spa
47,110
private function storeValueInCache ( $ key , $ value , $ expiration = null ) { $ this -> cache [ $ key ] = new MemcacheObject ( $ key , serialize ( $ value ) , $ this -> normalizeExpirationTime ( $ expiration ) ) ; }
Dumb setter no checks by design .
47,111
public static function initialize ( Dimension $ dimension , Number $ value ) : self { $ rows = [ ] ; $ count = $ dimension -> rows ( ) -> value ( ) ; for ( $ i = 0 ; $ i < $ count ; ++ $ i ) { $ rows [ ] = new RowVector ( ... array_fill ( 0 , $ dimension -> columns ( ) -> value ( ) , $ value ) ) ; } return new self ( ....
Initialize a matrix to the wished dimension filled with the specified value
47,112
public static function identifier ( string $ name , string $ separator = '_' ) : string { $ slugify = new Slugify ( [ 'separator' => $ separator ] ) ; $ identifier = $ slugify -> slugify ( $ name ) ; return $ identifier ; }
Gets an identifier from a name .
47,113
public static function getIdentifier ( string $ name , string $ separator = '_' ) : string { return self :: identifier ( $ name , $ separator ) ; }
Alias for the identifier function .
47,114
private function handle ( $ request ) { $ found = $ this -> fileMap -> render ( $ request -> getPathToMatch ( ) ) ; if ( empty ( $ found ) ) { return null ; } if ( is_resource ( $ found [ 0 ] ) ) { return $ request -> respond ( ) -> asFileContents ( $ found [ 0 ] , $ found [ 1 ] ) ; } if ( is_string ( $ found [ 0 ] ) )...
do the quick extension check .
47,115
public function options ( array $ options ) { if ( array_key_exists ( 'enable_raw' , $ options ) ) { $ this -> fileMap -> enable_raw = ( bool ) $ options [ 'enable_raw' ] ; } if ( array_key_exists ( 'before' , $ options ) ) { $ this -> setBeforeFilter ( $ options [ 'before' ] ) ; } if ( array_key_exists ( 'after' , $ o...
set up optional behavior .
47,116
final public function socketRecv ( & $ buff , $ len , $ flags ) { return socket_recv ( $ this -> socket , $ buff , $ len , $ flags ) ; }
Receives data from a connected socket
47,117
final public function socketRecvfrom ( & $ buff , $ len , $ flags , & $ name , & $ port = null ) { return socket_recvfrom ( $ this -> socket , $ buff , $ len , $ flags , $ name , $ port ) ; }
Receives data from a socket whether or not it is connection - oriented
47,118
final public function socketStrerror ( $ errno = null ) { if ( ! is_int ( $ errno ) ) { $ errno = $ this -> socketLastError ( ) ; } return socket_strerror ( $ errno ) ; }
Return a string describing a socket error
47,119
public function setSource ( ChildSource $ v = null ) { if ( $ v === null ) { $ this -> setSourceId ( NULL ) ; } else { $ this -> setSourceId ( $ v -> getId ( ) ) ; } $ this -> aSource = $ v ; if ( $ v !== null ) { $ v -> addPage ( $ this ) ; } return $ this ; }
Declares an association between this object and a ChildSource object .
47,120
public function getSource ( ConnectionInterface $ con = null ) { if ( $ this -> aSource === null && ( $ this -> source_id != 0 ) ) { $ this -> aSource = ChildSourceQuery :: create ( ) -> findPk ( $ this -> source_id , $ con ) ; } return $ this -> aSource ; }
Get the associated ChildSource object
47,121
public function initC2Ps ( $ overrideExisting = true ) { if ( null !== $ this -> collC2Ps && ! $ overrideExisting ) { return ; } $ collectionClassName = C2PTableMap :: getTableMap ( ) -> getCollectionClassName ( ) ; $ this -> collC2Ps = new $ collectionClassName ; $ this -> collC2Ps -> setModel ( '\Attogram\SharedMedia...
Initializes the collC2Ps collection .
47,122
public function getC2Ps ( Criteria $ criteria = null , ConnectionInterface $ con = null ) { $ partial = $ this -> collC2PsPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collC2Ps || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null === $ this -> collC2Ps ) { $ this -> initC2Ps ( ) ; } els...
Gets an array of ChildC2P objects which contain a foreign key that references this object .
47,123
public function addC2P ( ChildC2P $ l ) { if ( $ this -> collC2Ps === null ) { $ this -> initC2Ps ( ) ; $ this -> collC2PsPartial = true ; } if ( ! $ this -> collC2Ps -> contains ( $ l ) ) { $ this -> doAddC2P ( $ l ) ; if ( $ this -> c2PsScheduledForDeletion and $ this -> c2PsScheduledForDeletion -> contains ( $ l ) )...
Method called to associate a ChildC2P object to this object through the ChildC2P foreign key attribute .
47,124
public function initM2Ps ( $ overrideExisting = true ) { if ( null !== $ this -> collM2Ps && ! $ overrideExisting ) { return ; } $ collectionClassName = M2PTableMap :: getTableMap ( ) -> getCollectionClassName ( ) ; $ this -> collM2Ps = new $ collectionClassName ; $ this -> collM2Ps -> setModel ( '\Attogram\SharedMedia...
Initializes the collM2Ps collection .
47,125
public function getM2Ps ( Criteria $ criteria = null , ConnectionInterface $ con = null ) { $ partial = $ this -> collM2PsPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collM2Ps || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null === $ this -> collM2Ps ) { $ this -> initM2Ps ( ) ; } els...
Gets an array of ChildM2P objects which contain a foreign key that references this object .
47,126
public function addM2P ( ChildM2P $ l ) { if ( $ this -> collM2Ps === null ) { $ this -> initM2Ps ( ) ; $ this -> collM2PsPartial = true ; } if ( ! $ this -> collM2Ps -> contains ( $ l ) ) { $ this -> doAddM2P ( $ l ) ; if ( $ this -> m2PsScheduledForDeletion and $ this -> m2PsScheduledForDeletion -> contains ( $ l ) )...
Method called to associate a ChildM2P object to this object through the ChildM2P foreign key attribute .
47,127
public function setHashedPassword ( $ hashedPassword ) { if ( $ hashedPassword !== $ this -> hashedPassword ) { $ this -> authenticated = FALSE ; $ this -> hashedPassword = $ hashedPassword ; } return $ this ; }
set password hash ; if password hash differs from previously set hash any previous authentication result is reset
47,128
public function authenticate ( $ plaintextPassword ) { $ encrypter = new PasswordEncrypter ( ) ; $ this -> authenticated = $ encrypter -> isPasswordValid ( $ plaintextPassword , $ this -> hashedPassword ) ; return $ this ; }
compare passed plain text password with stored hashed password and store result
47,129
public function setRoles ( array $ roles ) { $ this -> roles = [ ] ; foreach ( $ roles as $ role ) { if ( ! $ role instanceof Role ) { throw new \ InvalidArgumentException ( 'Role is not a role instance.' ) ; } if ( array_key_exists ( $ role -> getRoleName ( ) , $ this -> roles ) ) { throw new \ InvalidArgumentExceptio...
set all roles of user
47,130
public function getRolesAndSubRoles ( RoleHierarchy $ roleHierarchy ) { $ possibleRoles = [ ] ; foreach ( $ this -> roles as $ role ) { $ possibleRoles [ ] = $ role ; $ possibleRoles = array_merge ( $ possibleRoles , $ roleHierarchy -> getSubRoles ( $ role ) ) ; return $ possibleRoles ; } }
return all possible roles and subroles - defined by a role hierarchy - the user can take
47,131
protected static function p2mSettings ( ) { if ( isset ( self :: $ _p2mSettings ) ) { return self :: $ _p2mSettings ; } return self :: getSettingsItem ( self :: $ _p2mSettings , Yii :: $ app -> params , 'p2m' ) ; }
Get p2m settings
47,132
protected static function getSettingsBlock ( $ name ) { return self :: getSettingsItem ( self :: $ _settingsBlock , self :: p2mSettings ( ) , $ name , false ) ; }
Get settings block
47,133
protected static function getSettingsItem ( & $ target , $ source , $ name = '' , $ default = false ) { if ( isset ( $ target ) ) { return $ target ; } $ useSource = true ; if ( $ source === false || ! isset ( $ source [ $ name ] ) ) { $ useSource = false ; } $ target = ( $ useSource ? $ source [ $ name ] : $ default )...
Get settings item
47,134
public function getTotalFiles ( ) { if ( ! $ this -> _files ) { $ this -> scan ; } $ i = 0 ; foreach ( $ this -> _files as $ file ) { if ( $ file -> isFile ) { $ i ++ ; } } return $ i ; }
count total files
47,135
public function addLayout ( $ id , $ content , array $ attributes = [ ] ) { $ key = $ this -> getLayoutNameWithNamespace ( $ id ) ; $ this -> layouts [ $ key ] = [ $ id , $ content , $ attributes ] ; }
Add a new layout .
47,136
public function executeActionsFromFile ( $ fileName ) { $ actions = array ( ) ; if ( file_exists ( $ fileName ) ) { $ actionsClasses = $ this -> decode ( $ fileName ) ; foreach ( $ actionsClasses as $ bundleName => $ actionsClass ) { $ this -> actionManagerGenerator -> generate ( $ actionsClass ) ; $ actions [ $ bundle...
Execute the actions from a json file
47,137
public function addField ( $ name , $ transformer = null , $ pos = null ) { if ( $ pos === null ) $ pos = sizeof ( $ this -> fields ) ; $ this -> fields [ $ pos ] = $ name ; if ( is_callable ( $ transformer ) ) $ this -> transformers [ $ pos ] = $ transformer ; else if ( $ transformer !== null ) throw new InvalidArgume...
Adds a named field to a CSV row .
47,138
public function addFields ( array $ fields ) { foreach ( $ fields as $ k => $ v ) if ( is_string ( $ k ) ) $ this -> addField ( $ k , $ v ) ; else $ this -> addField ( $ v ) ; return $ this ; }
Adds multiple fields with an optional transformer to a CSV row .
47,139
public function run ( ) { if ( empty ( $ this -> queues ) ) { die ( 'Set queues var containing the list of queues to work.' . PHP_EOL ) ; } Resque :: setBackend ( $ this -> redisBackend , $ this -> database , $ this -> password ) ; if ( $ this -> count > 1 ) { for ( $ i = 0 ; $ i < $ this -> count ; ++ $ i ) { $ pid = ...
Run to start workers
47,140
protected function _startWorker ( ) { $ worker = new Worker ( $ this -> queues ) ; $ worker -> logLevel = $ this -> logLevel ; fwrite ( STDOUT , '*** Starting worker ' . $ worker . PHP_EOL ) ; $ worker -> work ( $ this -> interval ) ; }
Start a worker
47,141
public function getKey ( ) : string { if ( $ this -> key === null ) { $ this -> key = md5 ( $ this -> getContent ( ) ) ; } return $ this -> key ; }
Get the entity key 304 response needs a proper key value
47,142
public function next ( ) { $ this -> key ++ ; if ( \ PDO :: FETCH_COLUMN !== $ this -> fetchMode ) { $ this -> current = $ this -> queryResult -> fetch ( $ this -> fetchMode , $ this -> driverOptions ) ; } else { $ this -> current = $ this -> queryResult -> fetchOne ( $ this -> driverOptions [ 'columnIndex' ] ?? 0 ) ; ...
iterates to next result element
47,143
public static function SplitIntoSegments ( $ number ) { $ number_str = $ number -> GetStringValue ( ) ; $ segments = [ ] ; $ NumberSegments = [ ] ; while ( strlen ( $ number_str ) > 0 ) { if ( strlen ( $ number_str ) < 3 ) { $ segments [ ] = $ number_str ; break ; } $ segment = substr ( $ number_str , - 3 ) ; $ number_...
This will split the number into chunks and then turn them each into NumberSegments .
47,144
public static function MakeNumberSegments ( $ segments ) { $ NumberSegments = [ ] ; foreach ( $ segments as $ segment ) { $ NumberSegments [ ] = new NumberSegment ( $ segment ) ; } return $ NumberSegments ; }
This is the actual factory method that converts regular string segments into the number segment types we need to work with .
47,145
public static function setEncoding ( $ encoding ) { if ( false === is_string ( $ encoding ) || 0 === strlen ( $ encoding ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ encoding ) ) , E_USER_ERROR ) ; } $ encoding = strtolower ( $ enco...
Set a new encoding
47,146
private static function cssMatcher ( $ matches ) { $ chr = $ matches [ 0 ] ; if ( 1 === strlen ( $ chr ) ) { $ ord = ord ( $ chr ) ; } else { $ chr = static :: convert ( $ chr , 'UTF-8' , 'UTF-32BE' ) ; $ ord = hexdec ( bin2hex ( $ chr ) ) ; } return sprintf ( '\\%X ' , $ ord ) ; }
Callback function for preg_replace_callback that applies CSS escaping to all matches .
47,147
private static function convert ( $ string , $ from , $ to ) { if ( true === function_exists ( 'iconv' ) ) { $ result = iconv ( $ from , $ to , $ string ) ; } elseif ( true === function_exists ( 'mb_convert_encoding' ) ) { $ result = mb_convert_encoding ( $ string , $ to , $ from ) ; } else { return trigger_error ( spr...
Converts string from encoding to another encoding
47,148
private static function toUtf8 ( $ string ) { if ( static :: getEncoding ( ) === 'utf-8' ) { $ result = $ string ; } else { $ result = static :: convert ( $ string , static :: getEncoding ( ) , 'UTF-8' ) ; } if ( false === static :: isUtf8 ( $ result ) ) { return trigger_error ( sprintf ( 'String to be escaped was not ...
Converts a string from UTF - 8 to the base encoding
47,149
public function clear ( ) { $ this -> bold = false ; $ this -> underscore = false ; $ this -> textColor = new Color ( ) ; $ this -> fillColor = new Color ( ) ; }
Set the state to clear no styling
47,150
public function findChanges ( TerminalStateInterface $ desired ) { $ ret = new self ( ) ; if ( ! $ this -> isBold ( ) && $ desired -> isBold ( ) ) { $ ret -> setBold ( true ) ; } else if ( $ this -> isBold ( ) && ! $ desired -> isBold ( ) ) { return null ; } if ( ! $ this -> isUnderscore ( ) && $ desired -> isUnderscor...
Compare the desired state and capture any things that are going from off to on if something is going from on to off then a clear needs to be sent along with all the desired state in this case this function returns null
47,151
public static function toArray ( $ object ) { if ( is_array ( $ object ) ) return $ object ; elseif ( ! is_object ( $ object ) ) return ( array ) $ object ; elseif ( $ object instanceof IlluminateCollection ) return $ object -> all ( ) ; elseif ( $ object instanceof IlluminateArrayable ) return $ object -> toArray ( ) ...
Cast the given object to an array
47,152
public function getLocaled ( string $ attribute ) { if ( Any :: isArray ( $ this -> { $ attribute } ) ) { return $ this -> { $ attribute } [ App :: $ Request -> getLanguage ( ) ] ; } if ( ! Any :: isStr ( $ attribute ) || Str :: likeEmpty ( $ this -> { $ attribute } ) ) { return null ; } return Serialize :: getDecodeLo...
Special function for locale stored attributes under serialization .
47,153
public function setAttribute ( $ key , $ value ) { if ( $ value !== null && $ this -> isSerializeCastable ( $ key ) ) { $ value = $ this -> asSerialize ( $ value ) ; } return parent :: setAttribute ( $ key , $ value ) ; }
Set model attribute . Extend laravel attribute casting mutators by serialized array
47,154
protected function castAttribute ( $ key , $ value ) { if ( $ value === null ) { return $ value ; } if ( $ this -> getCastType ( $ key ) === 'serialize' ) { return $ this -> fromSerialize ( $ value ) ; } return parent :: castAttribute ( $ key , $ value ) ; }
Cast model attribute . Extend laravel attribute casting mutators by serialized array
47,155
public static function fromSimpleXml ( $ xml , $ userId = null ) { $ torrent = new NyaaTorrent ( ) ; $ torrent -> title = ( string ) $ xml -> title ; $ torrent -> setInfoFromDescription ( ( string ) $ xml -> description ) ; $ torrent -> meta = NyaaMeta :: createFromTitle ( $ torrent -> title ) ; $ torrent -> torrentUrl...
Creates a new NyaaTorrent instance from a simple xml element
47,156
public function setInfoFromDescription ( $ description ) { if ( ! preg_match ( '~([0-9]+) seeder\(s\), ([0-9]+) leecher\(s\), ([0-9]+) download\(s\)(?: - ([0-9]+(\.[0-9]+)))?~i' , $ description , $ match ) ) { return ; } $ this -> seeds = intval ( $ match [ 1 ] ) ; $ this -> leechers = intval ( $ match [ 2 ] ) ; $ this...
Sets the torrent info from the description string
47,157
public function getUserId ( ) { if ( $ this -> userId === null ) { $ this -> userId = $ this -> fetchUserId ( ) ; } return $ this -> userId ; }
Gets the user id for this torrent
47,158
public function getTorrentId ( ) { if ( $ this -> torrentId === null ) { $ this -> torrentId = false ; if ( preg_match ( '~tid=([0-9]+)~' , $ this -> torrentUrl , $ match ) ) { $ this -> torrentId = intval ( $ match [ 1 ] ) ; } } return $ this -> torrentId ; }
Get the id of this torrent
47,159
private function fetchUserId ( ) { $ pool = Registry :: getStash ( ) ; $ cache = $ pool -> getItem ( 'nyaa/user/' . $ this -> getTorrentId ( ) ) ; if ( $ cache -> isMiss ( ) ) { $ userId = false ; $ html = file_get_contents ( $ this -> siteUrl ) ; if ( preg_match ( '~\/\?user\=([0-9]+)~i' , $ html , $ match ) ) { $ use...
Gets the user id by getting the overview of the torrent page and looking for the user id there
47,160
public function getMeta ( $ meta = null ) { if ( $ meta === null ) { return $ this -> meta ; } return $ this -> meta -> get ( $ meta ) ; }
Gets the NyaaMeta object or a meta value from the meta object if an argument is given
47,161
public function has ( $ id ) { if ( strpos ( $ id , '.' ) !== false ) { $ k = '$this->data' . "['" . str_replace ( '.' , "']['" , $ id ) . "']" ; eval ( '$has = isset(' . $ k . ');' ) ; return $ has ; } else { return ( is_string ( $ id ) ) ? array_key_exists ( $ id , $ this -> data ) : false ; } }
Returns true if the collection can return an entry for the given identifier returns false otherwise .
47,162
public function get ( $ id , $ default = null ) { if ( strpos ( $ id , '.' ) !== false ) { $ k = '$this->data' . "['" . str_replace ( '.' , "']['" , $ id ) . "']" ; eval ( '$has = isset(' . $ k . ');' ) ; if ( $ has ) { eval ( '$value = ' . $ k . ';' ) ; return $ value ; } else { return $ default ; } } else { return $ ...
Finds an entry of the collection by its identifier and returns it .
47,163
public function remove ( $ id ) { if ( $ this -> locked ) { return false ; } if ( strpos ( $ id , '.' ) !== false ) { $ k = '$this->data' . "['" . str_replace ( '.' , "']['" , $ id ) . "']" ; eval ( '$has = isset(' . $ k . ');' ) ; if ( $ has ) { eval ( 'unset(' . $ k . ');' ) ; return true ; } else { return false ; } ...
Removes the value from identified by an identifier from the colection
47,164
public function clearIdentity ( ) { $ this -> getStorage ( ) -> clear ( ) ; $ ids = $ this -> getContainer ( ) -> getIdentities ( ) ; $ sessionIds = array ( ) ; foreach ( $ ids as $ id ) { $ sessionIds [ ] = $ id -> getSessionId ( ) ; } $ this -> getSessionProvider ( ) -> clear ( $ sessionIds ) ; $ this -> getEventMana...
Clears the identity from persistent storage
47,165
public function addAspect ( Aspect $ aspect ) { if ( $ this -> container !== null ) { $ this -> container -> registerAspect ( $ aspect ) ; } return $ this ; }
Registers an aspect to the aspects kernel
47,166
public function dispatchResponse ( $ response ) { $ parts = explode ( "\r\n\r\n" , $ response , 2 ) ; if ( count ( $ parts ) < 2 ) { $ this -> throwException ( ) ; } list ( $ headersAsString , $ body ) = $ parts ; $ headers = explode ( "\r\n" , $ headersAsString ) ; list ( $ code , $ status ) = $ this -> dispatchHttpSt...
Get response code headers status body
47,167
protected function dispatchHttpStatus ( $ header ) { $ statuses = array ( ) ; $ result = preg_match ( '/^http\/[1|2]\.\d (\d{3}) (.*)$/i' , $ header , $ statuses ) ; if ( $ result < 1 ) { $ this -> throwException ( ) ; } return array ( ( int ) $ statuses [ 1 ] , $ statuses [ 2 ] ) ; }
Get HTTP status and code from first header
47,168
protected function dispatchHeaders ( $ headersAsString ) { $ headers = array ( ) ; foreach ( $ headersAsString as $ header ) { $ headerData = $ this -> dispatchHeaderValue ( $ header ) ; if ( is_null ( $ headerData ) ) { continue ; } $ headers [ $ headerData [ 'name' ] ] = $ headerData [ 'value' ] ; } return $ headers ...
Get headers an values
47,169
protected function dispatchHeaderValue ( $ header ) { $ header = explode ( ':' , $ header , 2 ) ; if ( count ( $ header ) < 2 ) { return null ; } return array ( 'name' => trim ( $ header [ 0 ] ) , 'value' => trim ( $ header [ 1 ] ) , ) ; }
Get key - value array
47,170
public function asString ( ) : string { $ fractionDigits = $ this -> currency -> getDefaultFractionDigits ( ) ; $ wholePart = substr ( ( string ) $ this -> amount , 0 , - $ fractionDigits ) ? : '0' ; $ fractionalPart = str_pad ( substr ( ( string ) $ this -> amount , - $ fractionDigits ) , $ fractionDigits , '0' , STR_...
Returns the monetary value as string .
47,171
static private function getDriver ( ) { if ( self :: $ _driver != null ) return self :: $ _driver ; $ driver = Utils :: spare ( Config :: get ( 'cache.driver' ) , 'file' ) ; switch ( strtolower ( $ driver ) ) { case 'memcached' : self :: $ _driver = new \ Lollipop \ Cache \ MemcachedAdapter ( ) ; break ; case 'file' : ...
Get cache driver
47,172
private function setAttributes ( ClassMetadataInfo $ metadata , Metadata \ AttributeInterface $ entity ) { foreach ( $ metadata -> fieldMappings as $ fieldKey => $ mapping ) { if ( isset ( $ mapping [ 'id' ] ) ) { continue ; } if ( isset ( $ mapping [ 'reference' ] ) ) { continue ; } if ( isset ( $ mapping [ 'inherited...
Sets the entity attribute metadata from the Doctrine class metadata .
47,173
private function setRelationships ( ClassMetadataInfo $ metadata , Metadata \ EntityMetadata $ entity ) { $ allTypes = $ this -> getAllTypeNames ( ) ; foreach ( $ metadata -> fieldMappings as $ fieldKey => $ mapping ) { if ( ! isset ( $ mapping [ 'reference' ] ) ) { continue ; } if ( ! isset ( $ mapping [ 'targetDocume...
Sets the entity relationship metadata from the Doctrine class metadata .
47,174
private function getDataType ( $ doctrineType ) { $ map = $ this -> getDoctrineTypeMap ( ) ; if ( ! isset ( $ map [ $ doctrineType ] ) ) { throw new InvalidArgumentException ( sprintf ( 'The Doctrine type "%s" is currenty not implemented by the API.' , $ doctrineType ) ) ; } return $ map [ $ doctrineType ] ; }
Gets the Modlr field data type from a Doctrine data type .
47,175
private function isPolymorphicType ( ClassMetadataInfo $ metadata ) { return in_array ( $ metadata -> inheritanceType , $ this -> getPolymorphicTypes ( ) ) && null === $ metadata -> discriminatorValue ; }
Determines if a Doctrine object is polymorphic based on its class metadata .
47,176
private function getTipTransUnit ( $ locale , $ domain , $ identifier ) { $ storage = $ this -> get ( 'lexik_translation.translation_storage' ) ; try { $ transUnits = $ storage -> getTransUnitsByLocaleAndDomain ( $ locale , $ domain ) ; } catch ( QueryException $ e ) { throw new \ RuntimeException ( 'Tips database not ...
Retrieve a random tip from the Lexik translations . Increment view count .
47,177
public function indexAction ( Request $ request , $ domain , $ identifier ) { $ locale = substr ( $ request -> getLocale ( ) , 0 , 2 ) ; try { $ transUnit = $ this -> getTipTransUnit ( $ locale , $ domain , $ identifier ) ; $ translatedTip = $ transUnit -> getTranslation ( $ locale ) ; return $ this -> render ( 'Tamago...
Render tip page with style and JavaScript .
47,178
public function feedbackAction ( Request $ request , $ id , $ feedback , $ domain , $ identifier ) { $ locale = substr ( $ request -> getLocale ( ) , 0 , 2 ) ; $ om = $ this -> getObjectManager ( ) ; $ repository = $ om -> getRepository ( 'TamagoTipsManagerBundle:TamagoTransUnitMeta' ) ; $ tipMetaData = $ repository ->...
Record feedback for given tip and return a new tip div block to be rendered via jQuery .
47,179
public function statsAction ( ) { $ om = $ this -> getObjectManager ( ) ; $ repository = $ om -> getRepository ( 'TamagoTipsManagerBundle:TamagoTransUnitMeta' ) ; $ stats = $ repository -> stats ( ) ; return $ this -> render ( 'TamagoTipsManagerBundle:Default:stats.html.twig' , [ 'stats' => $ stats ] ) ; }
Render stats page .
47,180
public static function OperatorPlus ( $ val1 , $ val2 ) { if ( ! $ val1 instanceof ValueProxy ) { $ f = isset ( ValueProxy :: $ valueFactory [ Type :: FromValue ( $ val1 ) -> getTypeName ( ) ] ) ? ValueProxy :: $ valueFactory [ Type :: FromValue ( $ val1 ) -> getTypeName ( ) ] : null ; if ( is_null ( $ f ) ) return fal...
Equivalent of the + operator
47,181
public function doExport ( ) { $ this -> downloadCsvExport ( ) ; $ settings = $ this -> module -> getSettings ( 'export' ) ; if ( empty ( $ settings [ 'columns' ] ) ) { $ settings [ 'columns' ] = array_keys ( $ settings [ 'header' ] ) ; } $ this -> setData ( 'settings' , $ settings ) ; $ this -> setData ( 'columns' , $...
Route callback to display the export page
47,182
protected function validateFileExport ( ) { $ directory = gplcart_file_private_module ( 'export' ) ; if ( ! file_exists ( $ directory ) && ! mkdir ( $ directory , 0775 , true ) ) { $ this -> setError ( 'file' , $ this -> text ( 'Unable to create @name' , array ( '@name' => $ directory ) ) ) ; return false ; } $ date = ...
Validates destination directory and file
47,183
protected function setJobExport ( ) { $ submitted = $ this -> getSubmitted ( ) ; $ settings = $ this -> module -> getSettings ( 'export' ) ; $ settings [ 'columns' ] = $ submitted [ 'columns' ] ; $ settings [ 'options' ] = $ submitted [ 'options' ] ; $ this -> module -> setSettings ( 'export' , $ settings ) ; $ data = ...
Sets up export job
47,184
protected function downloadCsvExport ( ) { $ file = $ this -> getQuery ( 'download' ) ; if ( ! empty ( $ file ) ) { $ this -> download ( gplcart_string_decode ( $ file ) ) ; } }
Download a created CSV file
47,185
public function loadMetadataForClass ( \ ReflectionClass $ class ) { foreach ( $ this -> drivers as $ driver ) { if ( null !== $ metadata = $ driver -> loadMetadataForClass ( $ class ) ) { return $ metadata ; } } }
Gets class metadata for the given class name .
47,186
public function isTransient ( $ className ) { foreach ( $ this -> drivers as $ driver ) { if ( false !== $ driver -> isTransient ( $ className ) ) { return true ; } } return false ; }
Returns whether the class with the specified name should have its metadata loaded .
47,187
public function getFullDescription ( ) { return strtr ( $ this -> template , [ "{name}" => $ this -> getName ( ) , "{description}" => $ this -> getDescription ( ) , "{version}" => $ this -> getVersion ( ) , "{ascii}" => $ this -> getAscii ( ) ] ) ; }
Return a composed - version of nominal values
47,188
private function AddMailSubjectField ( ) { $ name = 'MailSubject' ; $ field = Input :: Text ( $ name , $ this -> changePassword -> GetMailSubject ( ) ) ; $ this -> AddField ( $ field ) ; $ this -> SetRequired ( $ name ) ; }
Adds the field for e - mail field label
47,189
public function getObjectProperty ( $ object , $ property ) { $ result = null ; try { $ result = ObjectAccess :: getProperty ( $ object , $ property ) ; } catch ( \ Exception $ exception ) { if ( false === $ exception instanceof SilentExceptionInterface ) { throw $ exception ; } } return $ result ; }
This function will try to get a given property for a given object .
47,190
public function isRegistered ( $ name ) { return array_key_exists ( $ name , $ this -> services ) || ( isset ( $ this -> serviceProviders [ $ name ] ) && $ this -> serviceProviders [ $ name ] instanceof ServiceProviderInterface ) ; }
Check if service is registered
47,191
public static function createFactory ( callable $ configureMockProvider = null ) { $ factory = new Factory ( ) ; $ provider = new MockProvider ( $ factory ) ; if ( $ configureMockProvider ) { $ configureMockProvider ( $ provider ) ; } $ factory -> setProvider ( 'StdClass' , $ provider ) ; return $ factory ; }
Creates a Factory with MockProvider set as default Provider
47,192
function getDownloadUrl ( ) { $ inputs = self :: remoteXpathQuery ( $ this -> videoUrl , '/html/body/div[3]/div[2]/div[2]/div[7]/form/input[@name]' ) ; $ postFields = [ ] ; foreach ( $ inputs as $ input ) { $ postFields [ $ input -> getAttribute ( 'name' ) ] = $ input -> getAttribute ( 'value' ) ; } sleep ( 11 ) ; $ sc...
Special provider implementation
47,193
public function selectExcept ( $ fields ) { $ fields = array_diff ( $ this -> getFields ( ) , is_array ( $ fields ) ? $ fields : [ $ fields ] ) ; return $ this -> select ( $ fields ) ; }
Specifies an item that is not to be returned in the query result . Replaces any previously specified selections if any .
47,194
public function load ( $ names ) { foreach ( ( array ) $ names as $ name ) { $ parts = explode ( '.' , $ name , 2 ) ; $ name = $ parts [ 0 ] ; $ next = isset ( $ parts [ 1 ] ) ? $ parts [ 1 ] : null ; if ( isset ( $ this -> loadedRelations [ $ name ] ) ) { continue ; } $ related = $ this -> $ name ( ) ; $ isColl = $ re...
Eager load relations
47,195
protected function snake ( $ input ) { if ( isset ( static :: $ snakeCache [ $ input ] ) ) { return static :: $ snakeCache [ $ input ] ; } $ value = $ input ; if ( ! ctype_lower ( $ input ) ) { $ value = strtolower ( preg_replace ( '/(?<!^)[A-Z]/' , '_$0' , $ input ) ) ; } return static :: $ snakeCache [ $ input ] = $ ...
Convert a input to snake case
47,196
protected function camel ( $ input ) { if ( isset ( static :: $ camelCache [ $ input ] ) ) { return static :: $ camelCache [ $ input ] ; } return static :: $ camelCache [ $ input ] = lcfirst ( str_replace ( ' ' , '' , ucwords ( strtr ( $ input , '_-' , ' ' ) ) ) ) ; }
Convert a input to camel case
47,197
public function hasColumn ( $ name ) { $ name = $ this -> filterInputColumn ( $ name ) ; return in_array ( $ name , $ this -> getFields ( ) ) ; }
Check if column name exists
47,198
public function isChanged ( $ field = null ) { if ( $ field ) { $ field = $ this -> filterInputColumn ( $ field ) ; return array_key_exists ( $ field , $ this -> changedData ) ; } return $ this -> isChanged ; }
Check if the record s data or specified field is changed
47,199
public function toRet ( array $ merge = [ ] ) { if ( $ this -> isColl ( ) ) { return $ this -> suc ( $ merge + [ 'data' => $ this , 'page' => $ this -> getSqlPart ( 'page' ) , 'rows' => $ this -> getSqlPart ( 'limit' ) , 'records' => $ this -> count ( ) , ] ) ; } else { return $ this -> suc ( $ merge + [ 'data' => $ th...
Returns the success result with model data