idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
51,400
static function create ( $ width , $ height = 0 , $ mode = ImageResizeDefinition :: MODE_MAX , $ upscale = false ) { return new static ( $ width , $ height , $ mode , $ upscale ) ; }
Create an ImageResizeDefinition instance
51,401
public function onBootstrap ( EventInterface $ e ) { $ serviceManager = $ e -> getApplication ( ) -> getServiceManager ( ) ; $ this -> initPluginManagerFactory ( $ serviceManager , __NAMESPACE__ . '\SupervisorManager' , 'supervisor_plugin_manager' ) ; $ this -> initPluginManagerFactory ( $ serviceManager , __NAMESPACE_...
Bootstrap the module
51,402
protected function get ( $ name ) { $ this -> load ( ) ; return isset ( $ this -> lng [ $ name ] ) ? $ this -> lng [ $ name ] : $ name ; }
get language Value
51,403
public function message ( $ message , $ level , $ level_name , $ channel , $ datetime ) { $ datetime -> setTimezone ( new \ DateTimeZone ( 'UTC' ) ) ; $ this -> request -> setData ( array ( 'message' => $ message , 'status_code' => $ level , 'status_name' => $ level_name , 'channel' => $ channel , 'created_utc' => $ da...
Build message to send to AtomLogger
51,404
public function getContext ( $ name = null ) { if ( is_null ( $ name ) ) { $ name = $ this -> context ; } return isset ( $ this -> contexts [ $ name ] ) ? $ this -> contexts [ $ name ] : null ; }
Get a context URI from the array .
51,405
public function getPrefix ( ) { $ prefix = null ; if ( ! is_null ( $ this -> getContext ( ) ) ) { $ prefix = $ this -> getContext ( ) ; } if ( ! is_string ( $ this -> prefix ) ) { return $ prefix ; } return $ prefix . $ this -> prefix ; }
Get the prefix for this route group .
51,406
protected function _overflowHandler ( ) { return $ this -> _getAdapter ( ) -> overflow ( $ this -> _cacheKey , $ this -> getUsage ( ) - $ this -> getSize ( ) + 1 , $ this -> getUsage ( ) ) ; }
Buffer overflow handler
51,407
public function add ( $ data ) { if ( empty ( $ data ) || ! $ this -> _getAdapter ( ) -> isClientConnected ( ) ) { return false ; } if ( ! $ this -> _getAdapter ( ) -> add ( $ this -> _cacheKey , json_encode ( $ data ) ) ) { return false ; } if ( $ this -> getUsage ( ) >= $ this -> getSize ( ) ) { if ( ! empty ( $ this...
Add data to buffer
51,408
public function read ( ) { $ data = $ this -> _getAdapter ( ) -> read ( $ this -> _cacheKey ) ; if ( ! empty ( $ data ) && is_array ( $ data ) ) { foreach ( $ data as & $ row ) { $ row = json_decode ( $ row , 1 ) ; } } return $ data ; }
Read data from buffer
51,409
public function clearEntityManager ( $ managerName = null ) { if ( null === $ this -> doctrine ) { throw new \ Exception ( 'Doctrine is required' ) ; } if ( null === $ managerName ) { $ managerName = $ this -> doctrine -> getDefaultConnectionName ( ) ; } if ( ! array_key_exists ( $ managerName , $ this -> snapshots ) )...
Detach all objects in EntityManager persisted since snapshot
51,410
public function onBootstrap ( MvcEvent $ event ) { $ sharedEventManager = $ event -> getApplication ( ) -> getEventManager ( ) -> getSharedManager ( ) ; $ sharedEventManager -> attach ( AbstractActionController :: class , MvcEvent :: EVENT_DISPATCH , [ $ this , 'onDispatchedListener' ] , self :: DISPATCH_PRIORITY ) ; }
Module bootstrap handler
51,411
public function getControllerPluginConfig ( ) { return [ 'factories' => [ Controller \ Plugin \ Config :: class => Controller \ Plugin \ Factory \ ConfigFactory :: class , Controller \ Plugin \ Env :: class => Controller \ Plugin \ Factory \ EnvFactory :: class , Controller \ Plugin \ Server :: class => Controller \ Pl...
Configuration controller plugin
51,412
public function getViewHelperConfig ( ) { return [ 'factories' => [ View \ Helper \ Params :: class => View \ Helper \ Factory \ ParamsFactory :: class , View \ Helper \ Config :: class => View \ Helper \ Factory \ ConfigFactory :: class , View \ Helper \ Env :: class => View \ Helper \ Factory \ EnvFactory :: class , ...
Configuration view helper
51,413
protected function morphResponseIfNeeded ( $ response ) { $ contentType = $ this -> detectContentType ( $ response ) ; if ( $ newResponse = $ this -> getFromListeners ( $ contentType , $ response ) ) { return $ newResponse ; } }
Does the actual work . Looks if a morpher is set and call it if needed
51,414
protected function detectContentType ( $ response ) { if ( ! $ this -> contentTypeDetector ) { return $ this -> defaultContentType ; } if ( $ contentType = call_user_func ( $ this -> contentTypeDetector , $ response , $ this ) ) { return $ contentType ; } return $ this -> defaultContentType ; }
Detects the content type
51,415
protected function getFromListeners ( $ contentType , $ response ) { foreach ( [ 'before' , 'after' ] as $ position ) { foreach ( $ this -> getAfterOrBeforeListeners ( 'handle' , $ position ) as $ listener ) { if ( $ result = $ listener ( $ contentType , $ response , $ this ) ) { return $ result ; } } } return null ; }
Fires the event and returns the result if there were some
51,416
public function findByPath ( $ path ) { $ qb = $ this -> createQueryBuilder ( 'r' ) ; $ query = $ qb -> andWhere ( $ qb -> expr ( ) -> eq ( 'r.fromPath' , ':path' ) ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'r.enabled' , ':enabled' ) ) -> getQuery ( ) -> setMaxResults ( 1 ) ; return $ query -> setParameters ( [ 'path' =...
Finds the redirection by from path .
51,417
public function send ( Request $ request ) { $ headers = array ( 'Content-Type' => $ request -> getContentType ( ) ) ; $ content = $ request -> formatData ( ) ; if ( $ this -> hasSiteKey ( ) ) { $ headers = array_merge ( $ headers , array ( 'x-atom-log-id' => $ this -> getSiteKey ( ) ) ) ; } try { $ response = $ this -...
Send the Request
51,418
static public function resolve ( $ callback , \ Lollipop \ HTTP \ Request $ req , \ Lollipop \ HTTP \ Response $ res , array $ args = [ ] ) { if ( is_string ( $ callback ) ) { $ ctoks = explode ( '.' , $ callback ) ; $ output = '' ; switch ( count ( $ ctoks ) ) { case 1 : if ( ! function_exists ( $ action = $ ctoks [ 0...
Call callback and return data
51,419
public function addAssets ( array $ assets ) { foreach ( $ assets as $ asset ) { if ( ! is_array ( $ asset ) ) { throw new \ InvalidArgumentException ( 'Each element needs to be an array.' ) ; } $ this -> addAsset ( $ asset ) ; } }
Adds a list of assets to be processed by the asset writer .
51,420
public function addAsset ( array $ asset ) { if ( ! isset ( $ asset [ 'input' ] ) ) { throw new \ InvalidArgumentException ( 'Asset needs an input.' ) ; } if ( ! isset ( $ asset [ 'name' ] ) ) { $ asset [ 'name' ] = uniqid ( ) ; } if ( ! isset ( $ asset [ 'filter' ] ) ) { $ asset [ 'filter' ] = array ( ) ; } if ( ! is_...
Adds an asset to be processed by the asset writer .
51,421
public function offsetGet ( $ key ) { if ( ( $ index = $ this -> keysIndices [ self :: keyString ( $ key ) ] ?? null ) === null ) { return null ; } return $ this -> values [ $ index ] ; }
Retrieve a value with the given key .
51,422
public function offsetSet ( $ key , $ value ) { if ( $ key === null ) { $ intKeys = array_filter ( $ this -> keys , 'is_int' ) ; $ this -> keys [ ] = $ i = empty ( $ intKeys ) ? 0 : max ( max ( $ intKeys ) + 1 , 0 ) ; $ this -> values [ ] = $ value ; $ this -> keysIndices [ $ i ] = count ( $ this -> values ) - 1 ; } el...
Insert the given value with the given key .
51,423
public function offsetUnset ( $ key ) { $ keyString = self :: keyString ( $ key ) ; if ( ( $ index = $ this -> keysIndices [ $ keyString ] ?? null ) !== null ) { unset ( $ this -> keys [ $ index ] , $ this -> values [ $ index ] , $ this -> keysIndices [ $ keyString ] ) ; } }
Remove a value with the given key from the map .
51,424
public function getIterator ( ) : Traversable { foreach ( $ this -> values as $ index => & $ value ) { yield $ this -> keys [ $ index ] => $ value ; } }
Get the map iterator .
51,425
public function reset ( ) { $ uri = $ this -> createBaseUri ( ) -> withPath ( self :: API_RESET_URL ) ; $ request = ( new PsrRequest ( ) ) -> withUri ( $ uri ) -> withMethod ( 'post' ) ; $ this -> ensureIsNotErrorResponse ( $ this -> connection -> send ( $ request ) ) ; }
Restores pre - defined expectations and resets scenarios and requests counter .
51,426
public function resetScenarios ( ) { $ uri = $ this -> createBaseUri ( ) -> withPath ( self :: API_SCENARIOS_URL ) ; $ request = ( new PsrRequest ( ) ) -> withUri ( $ uri ) -> withMethod ( 'delete' ) ; $ this -> ensureIsNotErrorResponse ( $ this -> connection -> send ( $ request ) ) ; }
Resets all the scenarios to start state .
51,427
public function resetRequestsCounter ( ) { $ uri = $ this -> createBaseUri ( ) -> withPath ( self :: API_EXECUTIONS_URL ) ; $ request = ( new PsrRequest ( ) ) -> withUri ( $ uri ) -> withMethod ( 'delete' ) ; $ this -> ensureIsNotErrorResponse ( $ this -> connection -> send ( $ request ) ) ; }
Resets all the requests counters to 0 .
51,428
public function keep ( $ key ) { if ( isset ( $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] ) ) { $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] [ 1 ] = static :: EXPIRE_STATE_NEW ; return true ; } return false ; }
Reset the expiry state on the given key
51,429
public function expiration ( $ key ) { if ( isset ( $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] ) ) { $ expiration = array ( $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] [ 0 ] == EXPIRE_ON_REQUEST ? 'EXPIRE_ON_REQUEST' : 'EXPIRE_ON_GET' , $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] [ 1 ]...
Returns the expiry state on the given key
51,430
public function get ( $ key , $ default = null ) { if ( parent :: has ( $ this -> prefixKey ( $ key ) ) ) { if ( ! isset ( $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] ) ) { return parent :: get ( $ this -> prefixKey ( $ key ) , $ default ) ; } if ( $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] [ 1 ]...
Returns a key s value from this bag s data
51,431
public function delete ( $ key ) { unset ( $ this -> data [ static :: EXPIRE_DATA_KEY ] [ $ key ] ) ; return parent :: delete ( $ this -> prefixKey ( $ key ) ) ; }
Deletes data from the container
51,432
public function setContents ( array $ data ) { if ( isset ( $ data [ static :: EXPIRE_DATA_KEY ] ) ) { foreach ( $ data [ static :: EXPIRE_DATA_KEY ] as $ key => $ expiration ) { if ( $ expiration [ 1 ] === static :: EXPIRE_STATE_NEW ) { $ data [ static :: EXPIRE_DATA_KEY ] [ $ key ] [ 1 ] = static :: EXPIRE_STATE_LOAD...
Replaces the container s data
51,433
public function getContents ( ) { $ data = $ this -> data ; foreach ( $ data [ static :: EXPIRE_DATA_KEY ] as $ key => $ expiration ) { if ( $ expiration [ 1 ] === static :: EXPIRE_STATE_EXPIRED ) { unset ( $ data [ static :: EXPIRE_DATA_KEY ] [ $ key ] ) ; \ Arr :: delete ( $ data , $ this -> prefixKey ( $ key ) ) ; }...
Returns the container s data
51,434
public function cmdGetLibrary ( ) { $ list = $ this -> getListLibrary ( ) ; $ this -> outputFormat ( $ list ) ; $ this -> outputFormatTableLibrary ( $ list ) ; $ this -> output ( ) ; }
Callback for library - get command
51,435
public static function doesClassExtendClass ( $ childClassName , $ parentClassName ) { $ reflectionClass = new \ ReflectionClass ( $ childClassName ) ; do { if ( $ reflectionClass -> getName ( ) == $ parentClassName ) return true ; $ reflectionClass = $ reflectionClass -> getParentClass ( ) ; } while ( $ reflectionClas...
Check to see whether or not a given child class extends a given parent class
51,436
protected function _setPlaceholderTemplate ( $ template ) { if ( ! is_null ( $ template ) ) { $ template = $ this -> _normalizeStringable ( $ template ) ; } $ this -> placeholderTemplate = $ template ; }
Assigns the placeholder template to this instance .
51,437
public function run ( array $ args ) { $ command = ( string ) $ args [ 1 ] ; $ this -> router -> match ( $ command ) ; $ args = array_slice ( $ args , 2 ) ; return $ this -> router -> executeCommand ( $ args ) ; }
run run the command and return exit code .
51,438
protected function config ( $ data = [ ] ) { if ( null === $ data ) { $ data = [ ] ; } if ( false === is_array ( $ data ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type array, "%s" given' , __METHOD__ , gettype ( $ data ) ) , E_USER_ERROR ) ; } $ module = Router :: getRoute ( ) -> g...
Returns the config for the current module
51,439
public function aroundGetProductPrice ( \ Magento \ Catalog \ Block \ Product \ ListProduct $ subject , \ Closure $ proceed , \ Magento \ Catalog \ Model \ Product $ product ) { $ result = $ proceed ( $ product ) ; $ canSeePv = $ this -> hlpCust -> canSeePv ( ) ; if ( $ canSeePv ) { $ domId = "prxgt_pv_" . $ product ->...
Insert PV HTML before product price HTML .
51,440
public function drawByBlock ( array $ text ) { $ maxWidth = 0 ; foreach ( $ text as $ line ) { $ this -> drawByLine ( $ line , true ) ; $ lineWidth = $ this -> _getActualLength ( $ line ) ; if ( $ lineWidth > $ maxWidth ) { $ maxWidth = $ lineWidth ; } } $ this -> _canvasSize [ 0 ] += $ maxWidth ; echo $ this -> _curso...
Draw by block
51,441
public function drawByLine ( $ text , $ insertLineFeeds = true ) { $ convertedText = $ this -> _convertTagsToEscapeSequences ( $ text ) ; echo $ convertedText ; if ( $ insertLineFeeds === true ) { $ width = $ this -> _getActualLength ( $ text ) ; echo $ this -> _cursor -> insertLineFeeds ( $ width ) -> getEscapeSequenc...
Draw by line
51,442
public function finishDrawingByBlock ( ) { $ canvasHeight = $ this -> _canvasSize [ 1 ] ; echo str_repeat ( "\n" , $ canvasHeight ) ; $ this -> _cursor -> moveHome ( ) -> move ( 0 , $ canvasHeight ) ; return $ this ; }
Finish drawing by block
51,443
public static function getWindowSize ( ) { $ terminal = exec ( 'echo $TERM_PROGRAM' ) ; if ( $ terminal === 'Apple_Terminal' ) { $ windowWidth = exec ( 'tput cols' ) ; $ windowHeight = exec ( 'tput lines' ) ; } $ windowWidth = ( $ windowWidth > 0 ) ? $ windowWidth : self :: DEFAULT_WINDOW_WIDTH ; $ windowHeight = ( $ w...
Get terminal window size
51,444
private function _convertTagsToEscapeSequences ( $ text ) { list ( $ patterns , $ replacements ) = $ this -> _getConvertingDictionary ( ) ; $ convertedText = preg_replace ( $ patterns , $ replacements , $ text ) ; return $ convertedText ; }
Convert tags to escape sequences
51,445
private function _getActualLength ( $ text ) { $ convertedText = $ this -> _convertTagsToEscapeSequences ( $ text ) ; $ strippedText = $ this -> _stripEscapeSequences ( $ convertedText ) ; $ length = mb_strlen ( $ strippedText , 'utf-8' ) ; return $ length ; }
Get actual length
51,446
private function _getConvertingDictionary ( ) { $ definedColors = DecorationsObject :: getDefinedColors ( ) ; foreach ( $ definedColors as $ colorName => $ escapeSequences ) { list ( $ textColorEscapeSequence , $ backgroundColorEscapeSequence ) = $ escapeSequences ; $ patterns [ ] = "|<tc:$colorName>|" ; $ replacements...
Get converting dictionary
51,447
public static function back ( ) { $ referer = $ _SERVER [ 'HTTP_REFERER' ] ; if ( ! empty ( $ referer ) ) { return self :: redirect ( $ referer ) ; } return self :: redirect ( '/' ) ; }
Redirect to HTTP referer .
51,448
public function index ( $ trashed = false ) { $ this -> authorize ( PostsPolicy :: PERMISSION_LIST ) ; $ posts = $ this -> post -> with ( [ 'author' , 'category' ] ) -> when ( $ trashed , function ( $ query ) { return $ query -> onlyTrashed ( ) ; } ) -> paginate ( 30 ) ; $ title = trans ( 'blog::posts.titles.posts-list...
List the posts .
51,449
public function store ( CreatePostRequest $ request ) { $ this -> authorize ( PostsPolicy :: PERMISSION_CREATE ) ; $ post = Post :: createOne ( $ request -> getValidatedData ( ) ) ; $ this -> transNotification ( 'created' , [ 'title' => $ post -> title ] , $ post -> toArray ( ) ) ; return redirect ( ) -> route ( 'admin...
Store the post .
51,450
public function show ( Post $ post ) { $ this -> authorize ( PostsPolicy :: PERMISSION_SHOW ) ; $ post = $ post -> load ( [ 'author' , 'category' , 'tags' , 'seo' ] ) ; $ this -> setTitle ( trans ( 'blog::posts.titles.post-details' ) ) ; $ this -> addBreadcrumb ( $ post -> title ) ; return $ this -> view ( 'admin.posts...
Show a post .
51,451
public function edit ( Post $ post ) { $ this -> authorize ( PostsPolicy :: PERMISSION_UPDATE ) ; $ this -> setTitle ( $ title = trans ( 'blog::posts.titles.edit-post' ) ) ; $ this -> addBreadcrumb ( $ title ) ; $ categories = Category :: getSelectData ( ) ; $ tags = Tag :: getSelectData ( ) ; $ statuses = Post :: getS...
Edit a post .
51,452
public function update ( Post $ post , UpdatePostRequest $ request ) { $ this -> authorize ( PostsPolicy :: PERMISSION_UPDATE ) ; $ post -> updateOne ( $ request -> getValidatedData ( ) ) ; $ this -> transNotification ( 'updated' , [ 'title' => $ post -> title ] , $ post -> toArray ( ) ) ; return redirect ( ) -> route ...
Update the post .
51,453
public function restore ( Post $ post ) { $ this -> authorize ( PostsPolicy :: PERMISSION_UPDATE ) ; try { $ post -> restore ( ) ; return $ this -> jsonResponseSuccess ( [ 'message' => $ this -> transNotification ( 'restored' , [ 'title' => $ post -> title ] , $ post -> toArray ( ) ) ] ) ; } catch ( \ Exception $ e ) {...
Restore a trashed post .
51,454
protected function executeDestroy ( ) { if ( $ this -> reallyDestroy ) { parent :: executeDestroy ( ) ; } else { $ this -> saveData ( [ $ this -> deletedAtColumn => date ( 'Y-m-d H:i:s' ) , $ this -> deletedByColumn => $ this -> curUser [ 'id' ] , ] ) ; } }
Overwrite original destroy logic .
51,455
public function getFloatMajor ( ) { if ( $ this -> startsWith ( $ this -> major , '0' ) ) return ( float ) ( '0.' . substr ( $ this -> major , 1 ) ) ; return ( float ) $ this -> major ; }
Get floated major
51,456
public function getFloatMinor ( ) { if ( $ this -> startsWith ( $ this -> minor , '0' ) ) return ( float ) ( '0.' . substr ( $ this -> minor , 1 ) ) ; return ( float ) $ this -> minor ; }
Get floated minor
51,457
public function getFloatPath ( ) { if ( $ this -> startsWith ( $ this -> path , '0' ) ) return ( float ) ( '0.' . substr ( $ this -> path , 1 ) ) ; return ( float ) $ this -> path ; }
Get floated path
51,458
public function isPartOf ( Version $ version ) { if ( is_null ( $ version -> getOperator ( ) ) ) { if ( $ this -> major == $ version -> getMajor ( ) && $ this -> minor == $ version -> getMinor ( ) && $ this -> path == $ version -> getPath ( ) ) return true ; return false ; } switch ( $ version -> getOperator ( ) ) { ca...
Is this version part of another version?
51,459
protected function detectOperator ( ) { if ( $ this -> startsWith ( $ this -> version , self :: GREATER_EQUAL ) ) { $ this -> operator = self :: GREATER_EQUAL ; $ this -> version = substr ( $ this -> version , 2 ) ; } else if ( $ this -> startsWith ( $ this -> version , self :: GREATER ) ) { $ this -> operator = self :...
Detect operator of version
51,460
public function getConfig ( $ prefix ) { $ siteConfigService = $ this -> getServiceLocator ( ) -> get ( EyeService :: class ) ; $ config = $ siteConfigService -> getAll ( ) ; $ prefixParts = explode ( '.' , $ prefix ) ; $ conf = $ config ; foreach ( $ prefixParts as $ prefix ) { if ( isset ( $ conf [ $ prefix ] ) ) { $...
Get config for specified prefix
51,461
public function setExpression ( $ value ) { $ this -> cronParts = preg_split ( '/\s/' , $ value , - 1 , PREG_SPLIT_NO_EMPTY ) ; if ( count ( $ this -> cronParts ) < 6 ) { throw new InvalidArgumentException ( $ value . ' is not a valid CRON expression' ) ; } foreach ( $ this -> cronParts as $ position => $ part ) { $ th...
Set or change the CRON expression
51,462
public function setPart ( $ position , $ value ) { if ( ! $ this -> fieldFactory -> getField ( $ position ) -> validate ( $ value ) ) { throw new InvalidArgumentException ( 'Invalid CRON field value ' . $ value . ' as position ' . $ position ) ; } $ this -> cronParts [ $ position ] = $ value ; return $ this ; }
Set part of the CRON expression
51,463
public function isDue ( $ currentTime = null ) { if ( null === $ currentTime || 'now' === $ currentTime ) { $ currentDate = date ( 'Y-m-d H:i:s' ) ; $ currentTime = strtotime ( $ currentDate ) ; } elseif ( $ currentTime instanceof DateTime ) { $ currentDate = $ currentTime -> format ( 'Y-m-d H:i:s' ) ; $ currentTime = ...
Deterime if the cron is due to run based on the current date or a specific date . This method assumes that the current number of seconds are irrelevant and should be called once per minute .
51,464
public function setProtocol ( $ protocol ) { switch ( strtoupper ( $ protocol ) ) { case 'HTTP/1.0' : case 'HTTP/1.1' : $ this -> protocol = strtoupper ( $ protocol ) ; break ; default : throw new \ OutOfRangeException ( sprintf ( 'Unsupported protocol: "%s"' , $ protocol ) ) ; } return $ this ; }
Set the HTTP protocol being used .
51,465
public function hasHeader ( $ header ) { if ( $ header instanceof HttpHeaderInterface ) { return ! empty ( $ this -> headers [ strtolower ( $ header -> getFieldName ( ) ) ] ) ; } return ! empty ( $ this -> headers [ strtolower ( $ header ) ] ) ; }
Check if an HTTP header with the given name is set .
51,466
public function getHeader ( $ header ) { $ n = ( $ header instanceof HttpHeaderInterface ) ? strtolower ( $ header -> getFieldName ( ) ) : strtolower ( $ header ) ; if ( ! empty ( $ this -> headers [ $ n ] ) ) { return $ this -> headers [ $ n ] [ 0 ] [ 1 ] ; } if ( func_num_args ( ) > 1 ) { return func_get_arg ( 1 ) ; ...
Get the first HTTP header of the given type .
51,467
public function addHeader ( $ header , $ value = NULL ) { if ( $ header instanceof HttpHeaderInterface ) { $ n = strtolower ( $ header -> getFieldName ( ) ) ; if ( empty ( $ this -> headers [ $ n ] ) ) { $ this -> headers [ $ n ] = [ [ ( string ) $ header -> getFieldName ( ) , trim ( $ header -> getFieldValue ( ) ) ] ]...
Add an HTTP header to the message .
51,468
public function removeHeader ( $ header ) { if ( $ header instanceof HttpHeaderInterface ) { unset ( $ this -> headers [ strtolower ( $ header -> getFieldName ( ) ) ] ) ; } else { unset ( $ this -> headers [ strtolower ( $ header ) ] ) ; } return $ this ; }
Remove all HTTP headers of the given type from the message .
51,469
public function getHeaders ( $ name = NULL ) { if ( $ name === NULL ) { return $ this -> headers ; } $ n = strtolower ( $ name ) ; if ( empty ( $ this -> headers [ $ n ] ) ) { return [ ] ; } $ headers = [ ] ; foreach ( $ this -> headers [ $ n ] as $ data ) { $ headers [ ] = $ data ; } return $ headers ; }
Get all HTTP headers of this message .
51,470
protected function determineHeaderTypeName ( callable $ callback ) { if ( is_array ( $ callback ) ) { $ ref = new \ ReflectionMethod ( is_object ( $ callback [ 0 ] ) ? get_class ( $ callback [ 0 ] ) : $ callback [ 0 ] , $ callback [ 1 ] ) ; } elseif ( is_object ( $ callback ) && ! $ callback instanceof \ Closure ) { $ ...
Extract meta info of the first argument to the given callback and determine an HTTP header implementation to be used .
51,471
public function setEntity ( $ entity , $ prepare = true ) { if ( $ entity instanceof EntityInterface ) { $ this -> entity = $ entity ; } elseif ( is_resource ( $ entity ) || $ entity instanceof StreamInterface ) { $ this -> entity = new StreamEntity ( $ entity ) ; } elseif ( ( is_array ( $ entity ) || is_object ( $ ent...
Convert the given argument into an HTTP entity and put it in the nessage .
51,472
private function resolveClass ( $ object ) { if ( ! $ object instanceof Proxy ) { return get_class ( $ object ) ; } return $ this -> em -> getClassMetadata ( get_class ( $ object ) ) -> getReflectionClass ( ) -> getName ( ) ; }
Figure out the real class for this object .
51,473
public function cmdUninstallModule ( ) { $ result = $ this -> module_model -> uninstall ( $ this -> getParam ( 0 ) ) ; if ( $ result !== true ) { $ this -> errorAndExit ( $ result ) ; } $ this -> output ( ) ; }
Callback for module - uninstall command
51,474
public function cmdInstallModule ( ) { $ result = $ this -> module_model -> install ( $ this -> getParam ( 0 ) ) ; if ( $ result !== true ) { $ this -> errorAndExit ( $ result ) ; } $ this -> output ( ) ; }
Callback for module - install command
51,475
public function cmdOffModule ( ) { $ id = $ this -> getParam ( 0 ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ result = $ this -> module_model -> disable ( $ id ) ; if ( $ result !== true ) { $ this -> errorAndExit ( $ result ) ; } $ this -> output ( ) ; }
Callback for module - off command
51,476
public function cmdOnModule ( ) { $ id = $ this -> getParam ( 0 ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ result = $ this -> module_model -> enable ( $ id ) ; if ( $ result !== true ) { $ this -> errorAndExit ( $ result ) ; } $ this -> output ( ) ; }
Callback for module - on command
51,477
public function cmdGetModule ( ) { $ result = $ this -> getListModule ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableModule ( $ result ) ; $ this -> output ( ) ; }
Callback for module - get command
51,478
public function dispatch ( $ ignoreErrors = true , $ timeout = null ) { if ( ! isset ( $ this -> headers ) ) { $ this -> headers = array ( ) ; } if ( ! isset ( $ this -> headers [ "Content-Type" ] ) ) $ this -> headers [ "Content-Type" ] = "application/json" ; if ( $ this -> authUsername && $ this -> authPassword ) { $...
Dispatch the request and collect the result .
51,479
public function getNamespaceMappings ( ) { $ dom = ( new XmlDocumentBuilder ( ) ) -> buildDocument ( $ this ) ; $ xpath = new \ DOMXPath ( $ dom ) ; $ namespaces = [ ] ; foreach ( $ xpath -> query ( 'namespace::*' , $ dom -> documentElement ) as $ result ) { $ namespaces [ ( string ) $ result -> prefix ] = ( string ) $...
Get a map of namespaces prefix - URI mappings of the current node prefixes are keys .
51,480
protected function _make ( $ config = null ) { $ productClassname = $ this -> _normalizeString ( $ this -> _getProductClassname ( ) ) ; if ( ! $ this -> _classExists ( $ productClassname ) ) { throw $ this -> _createOutOfRangeException ( $ this -> __ ( 'Class "%1$s" does not exist' , [ $ productClassname ] ) , null , n...
Creates a new instance of a placeholder template .
51,481
public function apply ( ImageInterface $ image ) { switch ( $ this -> orientation ) { case 2 : $ image -> flipHorizontally ( ) ; break ; case 3 : $ image -> rotate ( 180 ) ; break ; case 4 : $ image -> flipVertically ( ) ; break ; case 5 : $ image -> rotate ( 90 ) -> flipHorizontally ( ) ; break ; case 6 : $ image -> r...
Applies scheduled transformation to ImageInterface instance Returns processed ImageInterface instance
51,482
private function getFieldOutputNumeric ( $ tblSrc , $ value , $ iar = [ ] ) { if ( $ value [ 'EXTRA' ] == 'auto_increment' ) { return $ this -> getFieldOutputNumericAI ( $ value , $ iar ) ; } $ fkArray = $ this -> getForeignKeysToArray ( $ this -> advCache [ 'workingDatabase' ] , $ tblSrc , $ value [ 'COLUMN_NAME' ] ) ...
Returns a Numeric field 2 use in a form
51,483
private function getFieldOutputNumericAI ( $ value , $ iar = [ ] ) { if ( $ this -> getFieldValue ( $ value ) == '' ) { $ spF = [ 'id' => $ value [ 'COLUMN_NAME' ] , 'style' => 'font-style:italic;' ] ; return $ this -> setStringIntoTag ( 'auto-numar' , 'span' , $ spF ) ; } $ inAdtnl = [ 'type' => 'hidden' , 'name' => $...
Handles creation of Auto Increment numeric field type output
51,484
private function getFieldOutputNumericNonFK ( $ fkArray , $ value , $ iar = [ ] ) { $ query = $ this -> sQueryGenericSelectKeyValue ( [ '`' . $ value [ 'COLUMN_NAME' ] . '`' , $ fkArray [ $ value [ 'COLUMN_NAME' ] ] [ 2 ] , $ fkArray [ $ value [ 'COLUMN_NAME' ] ] [ 0 ] , ] ) ; $ selectOptions = $ this -> setMySQLquery2...
Builds field output type for numeric types if not FK
51,485
private function getFieldOutputTextPrerequisites ( $ tbl , $ value ) { $ foreignKeysArray = [ ] ; if ( ( $ tbl != 'user_rights' ) && ( $ value [ 'COLUMN_NAME' ] != 'eid' ) ) { $ database = $ this -> advCache [ 'workingDatabase' ] ; if ( strpos ( $ tbl , '`.`' ) ) { $ database = substr ( $ tbl , 0 , strpos ( $ tbl , '`....
Prepares the text output fields
51,486
private function getForeignKeysToArray ( $ database , $ tblName , $ oCol = '' ) { if ( ! isset ( $ this -> advCache [ 'tableFKs' ] [ $ database ] [ $ tblName ] ) ) { $ this -> setTableForeignKeyCache ( $ database , $ this -> fixTableSource ( $ tblName ) ) ; } $ aRt = [ ] ; if ( isset ( $ this -> advCache [ 'tableFKs' ]...
Returns an array with fields referenced by a Foreign key
51,487
protected function setTableCache ( $ tblSrc ) { $ dat = $ this -> establishDatabaseAndTable ( $ tblSrc ) ; if ( ! isset ( $ this -> advCache [ 'tableStructureCache' ] [ $ dat [ 0 ] ] [ $ dat [ 1 ] ] ) ) { $ this -> advCache [ 'workingDatabase' ] = $ dat [ 0 ] ; $ this -> advCache [ 'tableStructureCache' ] [ $ dat [ 0 ]...
create a Cache for given table to use it in many places
51,488
private function content ( ) { $ handle = fopen ( $ this -> _config , 'r' ) ; $ content = @ json_decode ( stream_get_contents ( $ handle ) ) ; return $ content ; }
Gets the file session s content .
51,489
private function write ( $ content ) { $ handle = fopen ( $ this -> _config , 'w+' ) ; fwrite ( $ handle , @ json_encode ( $ content ) ) ; fclose ( $ handle ) ; }
Writes session info to file session .
51,490
public static function factory ( array $ subfield ) { if ( ! array_key_exists ( 'code' , $ subfield ) ) { throw new InvalidArgumentException ( "Missing 'code' index in subfield array" ) ; } if ( ! array_key_exists ( 'value' , $ subfield ) ) { throw new InvalidArgumentException ( "Missing 'value' index in subfield array...
Return a new subfield based on its array representation .
51,491
public function registerAlias ( $ alias , $ className ) { $ this -> _aliases [ $ alias ] = $ this -> resolveClassName ( $ className ) ; return $ this ; }
Registers a new alias with a specific FQCN
51,492
public function registerAliases ( array $ aliases ) { foreach ( $ aliases as $ alias => $ className ) $ this -> registerAlias ( $ alias , $ className ) ; return $ this ; }
Registers an array of aliases . The aliases should be the keys the FQCNs the values of the associative array
51,493
public function resolveClassName ( $ className ) { if ( isset ( $ this -> _aliases [ $ className ] ) ) $ className = $ this -> _aliases [ $ className ] ; return $ className ; }
Resolves a a class - name or an alias to a FQCN
51,494
public function createInstance ( $ className , array $ args = null ) { $ args = $ args ? $ args : [ ] ; $ className = $ this -> resolveClassName ( $ className ) ; if ( ! class_exists ( $ className ) || ( $ this -> _baseClassName && ! is_subclass_of ( $ className , $ this -> _baseClassName ) ) ) throw new FactoryExcepti...
Creates a new instance of a class based on a class name or alias given .
51,495
public function tagsByName ( $ name ) { $ tags = array ( ) ; foreach ( $ this -> tags ( ) as $ tag ) { if ( $ name === $ tag -> name ( ) ) { $ tags [ ] = $ tag ; } } return $ tags ; }
Get all the tags of this block with a specific tag name .
51,496
public static function bytesTo ( $ size , $ precision = 0 ) { $ sizes = array ( 'YB' , 'ZB' , 'EB' , 'PB' , 'TB' , 'GB' , 'MB' , 'KB' , 'B' ) ; $ total = count ( $ sizes ) ; while ( $ total -- && $ size >= 1024 ) { $ size /= 1024 ; } return static :: precision ( $ size , $ precision ) . $ sizes [ $ total ] ; }
Convert a numerical value to the readable string notated equivalent .
51,497
public static function convert ( $ no , $ fromBase , $ toBase ) { if ( $ fromBase == $ toBase ) { return $ no ; } return base_convert ( $ no , $ fromBase , $ toBase ) ; }
Convert a number from one base to another .
51,498
public static function currency ( $ number , array $ options = array ( ) ) { $ defaults = array ( 'thousands' => ',' , 'decimals' => '.' , 'places' => 2 , 'code' => 'USD #' , 'dollar' => '$#' , 'cents' => '#&cent;' , 'use' => 'dollar' , 'negative' => '(#)' ) ; $ options = $ options + $ defaults ; $ amount = number_form...
Convert a number to it s currency equivalent respecting locale . Allow for overrides through an options array .
51,499
public static function percentage ( $ number , $ options = array ( ) ) { if ( ! is_array ( $ options ) ) { $ options = array ( 'places' => $ options ) ; } $ options = $ options + array ( 'thousands' => ',' , 'decimals' => '.' , 'places' => 2 ) ; return number_format ( static :: precision ( $ number , $ options [ 'place...
Convert a number to a percentage string with decimal and comma separations .