idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
240,800
protected function renderError ( ElementInterface $ element ) { $ messages = $ element -> getMessages ( ) ; if ( empty ( $ messages ) ) { return null ; } $ errorPlugin = $ this -> getView ( ) -> plugin ( 'sxb_form_errors' ) ; return $ errorPlugin ( $ element ) ; }
Render errors .
240,801
private function getTips ( Description $ description ) { return array_map ( function ( \ stdClass $ tipDescription ) { return $ this -> tipFactory -> create ( new Description ( $ tipDescription ) ) ; } , $ description -> getOptionalProperty ( 'items' , [ ] ) ) ; }
Get the venue tips .
240,802
public static function arrayMap ( callable $ callback , array $ array ) { foreach ( $ array as $ key => $ value ) { $ array [ $ key ] = \ call_user_func ( $ callback , $ value , $ key ) ; } return $ array ; }
- array keys are available in callback - array keys have not been changed
240,803
private function expandConfigDirectories ( ) { $ newPaths = [ ] ; foreach ( $ this -> configDirectories as $ filePath ) { $ newPaths [ ] = __DIR__ . '/../../../../../' . $ filePath ; } $ this -> configDirectories = $ newPaths ; }
Ensures that config directories are relative paths
240,804
public function register ( $ alias , $ binding , $ shared = false ) { $ this -> registry [ $ alias ] = new Resolver ( new Builder ( $ binding ) , $ shared ) ; }
Register a binding with the registry
240,805
public function resolve ( $ alias , array $ parameters = array ( ) , $ force = false ) { if ( $ this -> registered ( $ alias ) ) { $ resolver = $ this -> registry [ $ alias ] ; return $ resolver -> execute ( $ parameters , $ force ) ; } throw new \ Exception ( 'No class found registered with that name: ' . $ alias ) ; ...
Execute the Resolver and return the requested binding instance
240,806
protected function updateAssignment ( ) { $ uri = str_replace ( '{assignment}' , $ this -> assignment , config ( 'forge-publish.update_assignment_uri' ) ) ; $ url = config ( 'forge-publish.url' ) . $ uri ; try { $ response = $ this -> http -> put ( $ url , [ 'form_params' => [ 'name' => $ this -> assignmentName , 'repo...
Update assignment .
240,807
public function form ( array $ options = [ ] ) { $ method = empty ( $ options [ 'method' ] ) ? $ options [ 'method' ] : '' ; if ( in_array ( strtolower ( $ method ) , [ 'get' , 'post' ] ) ) { $ real_method = $ method ; } else { $ real_method = 'POST' ; } $ options [ 'method' ] = $ real_method ; $ options [ 'action' ] =...
Generate the form .
240,808
public function add ( $ sHeader ) { foreach ( $ this -> headerList as $ sTmp ) { if ( $ sTmp == $ sHeader ) { throw new Exception ( "The '{$sHeader}' header has already been added." ) ; } } $ this -> headerList [ ] = $ sHeader ; return self :: $ instance ; }
It adds the header to the stack .
240,809
public function addByHttpCode ( $ nCode ) { $ sProtocol = isset ( $ _SERVER [ 'SERVER_PROTOCOL' ] ) ? $ _SERVER [ 'SERVER_PROTOCOL' ] : 'HTTP/1.1' ; $ sHeader = "{$sProtocol} {$nCode} " . self :: getHTTPExplanationByCode ( $ nCode ) ; return $ this -> add ( $ sHeader ) ; }
It adds the header to the stack by HTTP code .
240,810
public function run ( ) { $ this -> isRan = true ; foreach ( $ this -> headerList as $ sHeader ) { header ( $ sHeader ) ; } }
The main execution method . It sets all added headers into the page .
240,811
public function clearcache ( ) { if ( $ this -> view instanceof \ Sonic \ View \ Smarty ) { $ this -> view -> clearCompiledTemplate ( ) ; $ this -> view -> clearAllCache ( ) ; } new \ Sonic \ Message ( 'success' , 'Cache Cleared' ) ; $ this -> template = 'tools/index.tpl' ; }
Clear the view cache
240,812
public function highlight ( $ value , $ language ) { $ path = tempnam ( $ this -> tmp , 'pyg' ) ; if ( $ language === 'php' && substr ( $ value , 0 , 5 ) !== '<?php' ) { $ value = '<?php ' . PHP_EOL . $ value ; } $ this -> files -> dumpFile ( $ path , $ value ) ; $ value = $ this -> pygmentize ( $ path , $ language ) ;...
Highlight a portion of code with pygmentize
240,813
public function pygmentize ( $ path , $ language ) { $ process = new Process ( sprintf ( 'pygmentize -f html -l %s %s' , $ language , $ path ) ) ; $ process -> run ( ) ; if ( ! $ process -> isSuccessful ( ) ) { throw new RuntimeException ( $ process -> getErrorOutput ( ) ) ; } return trim ( $ process -> getOutput ( ) )...
Run pygmentize command on the given file
240,814
public function checkAuth ( ) { if ( isset ( $ _SESSION [ $ this -> _sessionVarName ] ) && $ _SESSION [ $ this -> _sessionVarName ] == 1 ) { return true ; } else { return false ; } }
Checks if a client is logged - in
240,815
public function assertIsNull ( $ value , $ message = 'Unexpected null value: %s' , $ exception = 'Asserts' ) { if ( is_null ( $ value ) ) { $ value = 'NULL' ; $ this -> throwException ( $ exception , $ message , $ value ) ; } }
Verifies that the specified condition is not null . The assertion fails if the condition is null .
240,816
public function row ( array $ attributes = array ( ) ) { $ row = new self ( ) ; if ( count ( $ attributes ) ) { $ row -> setAttributes ( $ attributes ) ; } return $ row ; }
Generates a new table row
240,817
public function add ( $ value , array $ attributes = null ) { $ cell = $ value ; if ( is_string ( $ value ) ) { $ cell = new Cell ( $ value , $ attributes ) ; } $ this -> _cells [ ] = $ cell ; return $ this ; }
Adds a cell to the row
240,818
public function isHeader ( $ isHeader = true ) { foreach ( $ this -> _cells as $ cell ) { $ cell -> isHeader ( $ isHeader ) ; } return $ this ; }
Set whether this row should be a table header or not
240,819
public function setState ( $ state = null ) { if ( null === $ state ) { $ this -> _state = $ state ; return $ this ; } if ( in_array ( $ state , array ( static :: STATE_SUCCESS , static :: STATE_ERROR , static :: STATE_INFO ) ) ) { $ this -> _state = $ state ; } return $ this ; }
Sets the row state
240,820
public function hasType ( $ nameOrType ) { $ name = $ nameOrType instanceof WidgetTypeInterface ? $ nameOrType -> getName ( ) : $ nameOrType ; return array_key_exists ( $ name , $ this -> types ) ; }
Returns whether the widget type is registered or not .
240,821
public function addType ( WidgetTypeInterface $ widget ) { if ( ! $ this -> hasType ( $ widget ) ) { $ this -> types [ $ widget -> getName ( ) ] = $ widget ; } else { throw new \ InvalidArgumentException ( sprintf ( 'Widget type "%s" is already registered.' , $ widget -> getName ( ) ) ) ; } }
Adds the widget type .
240,822
public function getType ( $ name ) { if ( $ this -> hasType ( $ name ) ) { return $ this -> types [ $ name ] ; } else { throw new \ InvalidArgumentException ( sprintf ( 'Widget type "%s" not found.' , $ name ) ) ; } }
Returns the widget type by name .
240,823
protected function parseResponse ( $ channel , $ content ) { $ headerSize = curl_getinfo ( $ channel , CURLINFO_HEADER_SIZE ) ; $ statusCode = curl_getinfo ( $ channel , CURLINFO_HTTP_CODE ) ; $ responseBody = substr ( $ content , $ headerSize ) ; $ responseHeaders = substr ( $ content , 0 , $ headerSize ) ; $ response...
Prepare response object
240,824
protected function _setContext ( $ context ) { $ this -> context = ( $ context !== null ) ? $ this -> _normalizeContainer ( $ context ) : null ; }
Sets the context for this instance .
240,825
public function toArray ( ) { $ hydrator = new ClassMethods ( ) ; $ vars = $ hydrator -> extract ( $ this ) ; foreach ( $ vars as $ key => & $ value ) { if ( $ value === null ) { unset ( $ vars [ $ key ] ) ; } elseif ( is_object ( $ value ) && ! $ value instanceof \ ArrayObject ) { if ( method_exists ( $ value , 'toArr...
Convert the model to an array .
240,826
protected function isRepeatRelational ( ) { $ is_repeat = false ; if ( array_count_values ( $ this -> getParentArray ( ) ) [ $ this -> prefix ] > 1 ) { $ is_repeat = true ; } return $ is_repeat ; }
Return true if relation is boucle infinie .
240,827
public function requireModel ( $ model , & $ data , $ prefix = null ) { $ class = null ; $ name = ( null !== $ prefix ) ? $ prefix : substr ( $ model , strlen ( explode ( '_' , $ model ) [ 0 ] ) + 7 ) ; foreach ( $ this -> array_prefix as $ k => $ ap ) { if ( strrpos ( $ ap , $ name ) === ( strlen ( $ ap ) - strlen ( $...
return Model if needed .
240,828
private function checkPearOrNoMatch ( $ classNameSpace , $ prefixLength , $ prefix ) { if ( ! $ classNameSpace ) { return false ; } if ( substr ( $ classNameSpace , 0 , $ prefixLength ) === $ prefix ) { return false ; } return true ; }
Check if the class is PEAR style or does not match at all .
240,829
public function pipe ( $ pipe , $ methodName = '' , ... $ params ) : self { if ( $ pipe instanceof Closure ) { $ this -> pipes [ ] = $ pipe ; return $ this ; } $ pipe = [ $ pipe , $ methodName , $ params , false ] ; $ this -> pipes [ ] = $ pipe ; return $ this ; }
Add stage for workflow .
240,830
public function pipeForContainer ( $ pipe , $ methodName = '' , ... $ params ) : self { if ( $ pipe instanceof Closure ) { $ this -> pipes [ ] = $ pipe ; return $ this ; } $ pipe = [ $ pipe , $ methodName , $ params , true ] ; $ this -> pipes [ ] = $ pipe ; return $ this ; }
Add stage without middleware interface .
240,831
public function execute ( ) { $ pipeline = array_reduce ( array_reverse ( $ this -> pipes ) , $ this -> carry ( ) , function ( $ passable ) { return $ passable ; } ) ; return $ pipeline ( $ this -> passable ) ; }
Run the pipeline without a final destination callback .
240,832
public function filtrarValor ( $ filtro , $ texto ) { if ( isset ( $ this -> filtros [ $ filtro ] ) ) { $ texto = $ this -> filtros [ $ filtro ] ( $ texto ) ; } return $ texto ; }
Aplica el filtro solicitado al valor .
240,833
public function sign ( array $ data ) { ksort ( $ data ) ; $ queryString = $ this -> buildQueryString ( $ data ) ; $ data [ 'h' ] = base64_encode ( hash_hmac ( 'sha1' , $ queryString , $ this -> clientSecret , true ) ) ; return $ data ; }
Signs an array by calculating a signature and setting it on the h key .
240,834
public function verifySignature ( array $ data ) { $ signedData = array_intersect_key ( $ data , array_flip ( self :: $ validResponseParams ) ) ; ksort ( $ signedData ) ; $ queryString = $ this -> buildQueryString ( $ signedData ) ; $ signature = base64_encode ( hash_hmac ( 'sha1' , $ queryString , $ this -> clientSecr...
Verifies that the signature in the h key matches the expected signature .
240,835
public function request ( ) { $ data = $ this -> prepareData ( ) ; $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ this -> apiHost . '/api' ) ; curl_setopt ( $ ch , CURLOPT_POST , true ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ data ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; $ result = ...
Run API reauest
240,836
private function prepareData ( ) { $ data = [ ] ; foreach ( get_object_vars ( $ this ) as $ property => $ value ) { if ( in_array ( $ property , [ 'apiHost' , 'debug' ] ) ) { continue ; } if ( $ property == 'format' ) { $ data [ $ value ] = '' ; } elseif ( is_bool ( $ value ) && $ value ) { $ data [ $ property ] = '' ;...
Preparing data before request
240,837
private function checkResult ( $ result ) { if ( $ this -> debug ) { if ( in_array ( $ this -> format , [ self :: FORMAT_JSON , self :: FORMAT_JSONP ] ) ) { $ result = json_decode ( $ result , true ) ; } elseif ( $ this -> format == self :: FORMAT_SERIAL ) { $ result = unserialize ( $ result ) ; } if ( is_array ( $ res...
Check response data
240,838
public function createService ( ServiceLocatorInterface $ serviceLocator ) { $ serviceLocator = $ serviceLocator -> getServiceLocator ( ) ; $ config = $ serviceLocator -> get ( 'Config' ) ; $ config = ( isset ( $ config [ 'yima_adminor' ] ) && is_array ( $ config [ 'yima_adminor' ] ) ) ? $ config [ 'yima_adminor' ] : [...
Create the Authentication Service
240,839
protected function _extractQuoteSkuData ( Mage_Sales_Model_Quote $ quote ) { $ skuData = [ ] ; foreach ( $ quote -> getAllVisibleItems ( ) as $ item ) { if ( $ item -> getParentItem ( ) ) { continue ; } $ skuData [ $ item -> getSku ( ) ] = [ 'item_id' => $ item -> getId ( ) , 'managed' => Mage :: helper ( 'radial_core/...
Get sku and qty data for a given quote
240,840
protected function _extractAddressData ( Mage_Customer_Model_Address_Abstract $ address ) { return array ( 'street' => $ address -> getStreet ( ) , 'city' => $ address -> getCity ( ) , 'region_code' => $ address -> getRegionCode ( ) , 'country_id' => $ address -> getCountryId ( ) , 'postcode' => $ address -> getPostcod...
Extract array of address data - street city region code etc . from an address object
240,841
protected function _extractQuoteShippingData ( Mage_Sales_Model_Quote $ quote ) { $ shippingData = array ( ) ; foreach ( $ quote -> getAllShippingAddresses ( ) as $ address ) { $ shippingData [ ] = array ( 'method' => $ address -> getShippingMethod ( ) , 'address' => $ this -> _extractAddressData ( $ address ) , ) ; } ...
Extract shipping data from a quote - the shipping method and address for each shipping address in the quote .
240,842
protected function _extractQuoteBillingData ( Mage_Sales_Model_Quote $ quote ) { $ address = $ quote -> getBillingAddress ( ) ; return $ address ? $ this -> _extractAddressData ( $ address ) : array ( ) ; }
Return array of billing address data if available otherwise an empty array
240,843
protected function _extractQuoteAmounts ( Mage_Sales_Model_Quote $ quote ) { return array_map ( function ( $ address ) { return array ( 'subtotal' => round ( $ address -> getSubtotal ( ) , 4 ) ? : 0.0000 , 'discount' => round ( $ address -> getDiscountAmount ( ) , 4 ) ? : 0.0000 , 'ship_amount' => round ( $ address -> ...
Extract quote amounts from each address .
240,844
protected function _diffQuoteData ( $ oldQuote , $ newQuote ) { if ( empty ( $ oldQuote ) ) { return $ newQuote ; } return $ this -> _diffBilling ( $ oldQuote [ 'billing' ] , $ newQuote [ 'billing' ] ) + $ this -> _diffCoupon ( $ oldQuote [ 'coupon' ] , $ newQuote [ 'coupon' ] ) + $ this -> _diffShipping ( $ oldQuote [...
Diff the new quote to the old quote . May contain keys for billing coupon shipping and skus . For more details on the type of changes detected for each key see the responsible methods for diffing those sets of data .
240,845
protected function _anyItem ( $ items , $ key ) { foreach ( $ items as $ item ) { if ( isset ( $ item [ $ key ] ) && $ item [ $ key ] ) { return true ; } } return false ; }
Check the set of items to have an item with the given key set to a truthy value .
240,846
public function keepOpen ( ) { $ stoppedProperty = new \ ReflectionProperty ( get_parent_class ( $ this ) , 'stopped' ) ; $ stoppedProperty -> setAccessible ( TRUE ) ; $ stoppedProperty -> setValue ( $ this , TRUE ) ; }
Calling this method avoids destructor to send DELETE session request .
240,847
public function getLink ( $ presenterName , $ parameters = array ( ) ) { $ url = new \ Nette \ Http \ UrlScript ( $ this -> context -> parameters [ 'selenium' ] [ 'baseUrl' ] ) ; $ url -> scriptPath = $ url -> path ; $ appRequest = new \ Nette \ Application \ Request ( $ presenterName , 'GET' , Utils :: strToArray ( $ ...
Creates an URL .
240,848
public function getAppRequest ( $ url = NULL ) { $ httpRequest = new \ Nette \ Http \ Request ( $ this -> getUrlScriptForUrl ( $ url ? : $ this -> url ( ) ) ) ; return $ this -> context -> router -> match ( $ httpRequest ) ; }
URL back - routed into application request object .
240,849
public function waitForAlert ( $ timeout = 60 ) { $ result = FALSE ; $ i = 0 ; do { sleep ( 1 ) ; try { $ result = $ this -> alertText ( ) ; } catch ( \ RuntimeException $ e ) { ; } } while ( ++ $ i < $ timeout && $ result === FALSE ) ; return $ result ; }
Wait for javascript alert prompt or confirm dialog .
240,850
public function waitForCondition ( $ jsCondition , $ timeout = 60 ) { $ i = 0 ; do { sleep ( 1 ) ; } while ( ! ( $ result = $ this -> execute ( array ( 'script' => 'return ' . $ jsCondition , 'args' => array ( ) ) ) ) && $ i ++ < $ timeout ) ; return $ result ; }
Wait for fulfilment of some javascript condition .
240,851
public function getActiveElement ( ) { $ response = $ this -> driver -> curl ( 'POST' , $ this -> url -> addCommand ( 'element/active' ) ) ; return Element :: fromResponseValue ( $ response -> getValue ( ) , $ this -> url -> descend ( 'element' ) , $ this -> driver ) ; }
Get the element on the page that currently has focus .
240,852
public function element ( \ PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $ criteria ) { $ value = $ this -> postCommand ( 'element' , $ criteria ) ; return Element :: fromResponseValue ( $ value , $ this -> url -> descend ( 'element' ) , $ this -> driver ) ; }
Finds an element using the criteria .
240,853
public function elements ( \ PHPUnit_Extensions_Selenium2TestCase_ElementCriteria $ criteria ) { $ values = $ this -> postCommand ( 'elements' , $ criteria ) ; $ elements = array ( ) ; foreach ( $ values as $ value ) { $ elements [ ] = Element :: fromResponseValue ( $ value , $ this -> url -> descend ( 'element' ) , $ ...
Finds elements using given criteria .
240,854
public function getRequiredModules ( $ moduleName ) { $ moduleName = strtolower ( $ moduleName ) ; if ( isset ( $ this -> _requiredModules [ $ moduleName ] ) ) { return $ this -> _requiredModules [ $ moduleName ] ; } else { return null ; } }
Gets a module
240,855
public function readConfig ( $ configFile ) { $ yamlParser = new \ Symfony \ Component \ Yaml \ Parser ( ) ; $ userConfPath = ROOT . DS . 'app' . DS . 'config' . DS . 'modules' . DS . $ configFile ; $ userCustomPath = ROOT . DS . 'app' . DS . 'modules' . DS . $ configFile ; $ composerConfPath = ROOT . DS . 'modules' . ...
Reads the configuration file ad returns a configuration array
240,856
public function addSharedInstance ( $ instance , $ classOrAlias ) { if ( ! is_object ( $ instance ) ) { throw new Exception ( 'This method requires an object to be shared. Class or Alias given: ' . $ classOrAlias ) ; } $ this -> sharedInstances [ $ classOrAlias ] = $ instance ; }
Add shared instance
240,857
public function getSharedInstanceWithParameters ( $ classOrAlias , array $ params , $ fastHashFromHasLookup = null ) { if ( $ fastHashFromHasLookup ) { return $ this -> sharedInstancesWithParams [ 'hashLong' ] [ $ fastHashFromHasLookup ] ; } ksort ( $ params ) ; $ hashKey = $ this -> createHashForKeys ( $ classOrAlias ...
Retrieves an instance by its name and the parameters stored at its instantiation
240,858
public function hasConfig ( $ aliasOrClass ) { $ key = ( $ this -> hasAlias ( $ aliasOrClass ) ) ? 'alias:' . $ this -> getBaseAlias ( $ aliasOrClass ) : $ aliasOrClass ; if ( ! isset ( $ this -> configurations [ $ key ] ) ) { return false ; } if ( $ this -> configurations [ $ key ] === $ this -> configurationTemplate ...
Check for configuration
240,859
public function hasTypePreferences ( $ interfaceOrAbstract ) { $ key = ( $ this -> hasAlias ( $ interfaceOrAbstract ) ) ? 'alias:' . $ interfaceOrAbstract : $ interfaceOrAbstract ; return ( isset ( $ this -> typePreferences [ $ key ] ) && $ this -> typePreferences [ $ key ] ) ; }
Check for type preferences
240,860
public function setTypePreference ( $ interfaceOrAbstract , array $ preferredImplementations ) { $ key = ( $ this -> hasAlias ( $ interfaceOrAbstract ) ) ? 'alias:' . $ interfaceOrAbstract : $ interfaceOrAbstract ; foreach ( $ preferredImplementations as $ preferredImplementation ) { $ this -> addTypePreference ( $ key...
Set type preference
240,861
public function getTypePreferences ( $ interfaceOrAbstract ) { $ key = ( $ this -> hasAlias ( $ interfaceOrAbstract ) ) ? 'alias:' . $ interfaceOrAbstract : $ interfaceOrAbstract ; if ( isset ( $ this -> typePreferences [ $ key ] ) ) { return $ this -> typePreferences [ $ key ] ; } return [ ] ; }
Get type preferences
240,862
public function unsetTypePreferences ( $ interfaceOrAbstract ) { $ key = ( $ this -> hasAlias ( $ interfaceOrAbstract ) ) ? 'alias:' . $ interfaceOrAbstract : $ interfaceOrAbstract ; unset ( $ this -> typePreferences [ $ key ] ) ; }
Unset type preferences
240,863
public function removeTypePreference ( $ interfaceOrAbstract , $ preferredType ) { $ key = ( $ this -> hasAlias ( $ interfaceOrAbstract ) ) ? 'alias:' . $ interfaceOrAbstract : $ interfaceOrAbstract ; if ( ! isset ( $ this -> typePreferences [ $ key ] ) || ! Arrays :: in ( $ preferredType , $ this -> typePreferences [ ...
Removes a previously set type preference
240,864
protected function toAssocRecursive ( $ input , SplObjectStorage $ list ) : array { $ values = is_iterable ( $ input ) ? i \ iterable_to_array ( $ input ) : object_get_properties ( $ input , $ input instanceof stdClass || $ input instanceof DynamicEntity ) ; foreach ( $ values as $ key => & $ value ) { if ( $ value ins...
Recursively cast to associative arrays .
240,865
public function getStills ( ) { if ( ! isset ( $ this -> stills ) ) { $ this -> stills = [ new Still ( $ this -> thumbnail_url , 'default' ) , new Still ( $ this -> thumbnail_url_lq , 'lq' ) , new Still ( $ this -> thumbnail_url_mq , 'mq' ) , ] ; } return $ this -> stills ; }
Generate a list of Still entities based on other properties that come from VM 6 .
240,866
private function get ( String $ id ) { if ( ! $ id ) { $ id = ConnectionManager :: DEFAULT_CONNECTION_ID ; } if ( count ( $ this -> loadedConnections ) < 1 ) { return false ; } if ( isset ( $ this -> loadedConnections [ $ id ] ) ) { $ this -> configuredConnectionId = $ id ; $ this -> platformConnector = [ $ id => $ thi...
Try to connection with this id from the loaded connections in the configuration file .
240,867
public static function toString ( ) { $ return = [ ] ; foreach ( static :: $ globals as $ key => $ value ) { $ type = gettype ( $ value ) ; if ( is_callable ( $ value ) ) { $ valueString = 'callable' ; $ type = 'callable' ; } elseif ( is_array ( $ value ) ) { $ valueString = implode ( ', ' , $ value ) ; } else { $ valu...
Return keys and values of global variables as string
240,868
public function actionEditableSaver ( ) { Yii :: import ( 'EditableSaver' ) ; $ es = new EditableSaver ( 'CcucUserCompany' ) ; $ es -> update ( ) ; if ( $ es -> attribute != 'ccuc_status' ) { return ; } if ( $ es -> value != CcucUserCompany :: CCUC_STATUS_USER ) { return ; } $ m = Person :: model ( ) ; return $ m -> cr...
for company ccuc on change status to USER create customer office uses
240,869
public function load ( $ name ) { $ factoryClass = ucfirst ( $ name ) . "Phactory" ; if ( ! class_exists ( $ factoryClass ) ) { throw new \ Exception ( "Unknown factory '$name'" ) ; } return new Factory ( $ name , new $ factoryClass ) ; }
Loads the factory according to the object class name
240,870
public static function generateValidXmlFromArray ( $ array , $ node_block = 'response' , $ node_name = 'item' ) { $ xml = '<?xml version="1.0" encoding="UTF-8" ?>' ; $ xml .= '<' . $ node_block . '>' ; $ xml .= self :: generateXmlFromArray ( $ array , $ node_name ) ; $ xml .= '</' . $ node_block . '>' ; return $ xml ; ...
Generate valid xml from array
240,871
private static function generateXmlFromArray ( $ array , $ node_name ) { $ xml = '' ; if ( is_array ( $ array ) || is_object ( $ array ) ) { foreach ( $ array as $ key => $ value ) { if ( is_numeric ( $ key ) ) { $ key = $ node_name ; } $ xml .= '<' . $ key . '>' . self :: generateXmlFromArray ( $ value , $ node_name )...
Generate XML from array
240,872
protected function addDeferLog ( $ role , $ level , $ message , $ context ) { $ this -> deferLogs [ ] = compact ( 'role' , 'level' , 'message' , 'context' ) ; $ this -> deferLogsCount ++ ; }
Add a defer log
240,873
protected function removeDeferLog ( $ k ) { if ( ! isset ( $ this -> deferLogs [ $ k ] ) ) { return ; } unset ( $ this -> deferLogs [ $ k ] ) ; $ this -> deferLogsCount -- ; }
Remove a defer log
240,874
public function flush ( ) { foreach ( $ this -> deferLogs as $ k => $ deferLog ) { $ this -> record ( $ deferLog [ 'message' ] , $ deferLog [ 'context' ] , $ deferLog [ 'level' ] , $ deferLog [ 'role' ] ) ; $ this -> removeDeferLog ( $ k ) ; } }
Flush defer logs
240,875
protected function addCacheDirectory ( ContainerInterface $ container , SerializerBuilder $ builder ) : void { $ config = $ container -> get ( 'config' ) ; $ libraryConfig = $ config [ ConfigKey :: PROJECT ] [ ConfigKey :: API_CLIENT ] ?? [ ] ; $ cacheDir = ( string ) ( $ libraryConfig [ ConfigKey :: CACHE_DIR ] ?? '' ...
Adds the cache directory from the config to the builder .
240,876
public function setOptions ( $ options ) { if ( ! is_array ( $ options ) && ! $ options instanceof Traversable ) { throw new \ InvalidArgumentException ( sprintf ( 'Expected an array or Traversable; received "%s"' , ( is_object ( $ options ) ? get_class ( $ options ) : gettype ( $ options ) ) ) ) ; } foreach ( $ option...
Configure service broker
240,877
public function getDefaultIdentity ( ) { if ( ! $ this -> defaultIdentity ) { $ this -> defaultIdentity = new ArrayObject ( array ( ) ) ; if ( $ this -> exists ( 'Identity' ) ) { $ responses = $ this -> execute ( 'Identity' , 'getIdentity' , array ( ) , function ( $ response ) { if ( $ response instanceof ArrayAccess )...
Retrieve default identity
240,878
public function setLoader ( ServiceLoader $ loader ) { $ this -> loader = $ loader ; $ that = $ this ; $ this -> loader -> addInitializer ( function ( $ instance ) use ( $ that ) { if ( $ instance instanceof Feature \ ServiceBrokerAwareInterface ) { $ instance -> setServiceBroker ( $ that ) ; } if ( $ instance instance...
Set service loader instance
240,879
public function service ( $ service ) { if ( ! $ this -> exists ( $ service ) ) { throw new ServiceNotFoundException ( sprintf ( 'Service "%s" not found' , $ service ) ) ; } return new Worker ( $ this , $ service ) ; }
Initialize and retrieve a new service Worker
240,880
public function executeInContext ( $ context , $ service , $ operation , $ argv = array ( ) , $ callback = null ) { $ command = new Command ( $ service , $ operation , $ argv , $ context ) ; return $ this -> dispatch ( $ command , $ callback ) ; }
Execute service operation in context
240,881
public function queue ( CommandInterface $ command , array $ options = [ ] ) { $ queueName = null ; if ( array_key_exists ( self :: QUEUE_OPTION_NAME , $ options ) ) { $ queueName = $ options [ self :: QUEUE_OPTION_NAME ] ? : null ; unset ( $ options [ self :: QUEUE_OPTION_NAME ] ) ; } $ queue = $ this -> getQueue ( $ ...
Queue execution of service operation
240,882
protected function createEvent ( $ name , CommandInterface $ command ) { $ event = new ServiceEvent ( ) ; $ event -> setName ( $ name ) ; $ event -> setCommand ( $ command ) ; $ event -> setParams ( $ command -> getParams ( ) ) ; return $ event ; }
Create a new service event
240,883
public function getCurrency ( ) { $ options = [ 'EUR' => __ ( 'Euro' ) , 'GBP' => __ ( 'Sterling' ) , 'USD' => __ ( 'US Dollar' ) , 'CAD' => __ ( 'Canadian Dollar' ) , 'AUD' => __ ( 'Australian Dollar' ) , 'DKK' => __ ( 'Danish Krone' ) , 'SEK' => __ ( 'Swedish Krona' ) , 'NOK' => __ ( 'Norwegian Krone' ) ] ; return $ ...
Get Grid row currency labels array .
240,884
protected function processComment ( ) { $ comment = strtr ( trim ( preg_replace ( '/^\s*\**( |\t)?/m' , '' , trim ( $ this -> getDocComment ( ) , '/' ) ) ) , "\r" , '' ) ; if ( preg_match ( '/^\s*@\w+/m' , $ comment , $ matches , PREG_OFFSET_CAPTURE ) ) { $ meta = substr ( $ comment , $ matches [ 0 ] [ 1 ] ) ; $ this -...
gets tags lines from docblock
240,885
protected function processTags ( $ comment ) { $ tags = preg_split ( '/^\s*@/m' , $ comment , - 1 , PREG_SPLIT_NO_EMPTY ) ; foreach ( $ tags as $ tag ) { $ segs = preg_split ( '/\s+/' , trim ( $ tag ) , 2 ) ; $ tagName = $ segs [ 0 ] ; $ param = isset ( $ segs [ 1 ] ) ? trim ( $ segs [ 1 ] ) : '' ; $ this -> tags [ $ t...
extracts tags array from docblock
240,886
public function getFactory ( Specification $ spec ) : Factory { if ( ! isset ( $ this -> factories [ get_class ( $ spec ) ] ) ) { throw new \ OutOfRangeException ( sprintf ( 'Factory for Specification "%s" not registred' , get_class ( $ spec ) ) ) ; } return $ this -> factories [ get_class ( $ spec ) ] ; }
Get registred factory for Specification
240,887
public function retry ( int $ delayed = 0 ) : void { $ this -> link -> req ( $ this -> id ( ) , $ delayed ) ; }
delayed in milliseconds
240,888
public function parse ( $ template ) { $ viewsFromConfig = $ this -> app [ 'config' ] -> get ( 'view.paths' ) ; $ views = array_merge ( ( array ) $ viewsFromConfig , ( array ) $ this -> paths [ 'theme' ] ) ; $ cache = $ this -> paths [ 'storage' ] . '/views' ; $ blade = new BladeAdapter ( $ views , $ cache ) ; if ( ! $...
Handle the compilation of the templates
240,889
protected function validateType ( $ value ) { if ( ! $ value instanceof Closure && $ value !== null ) { $ exception = new InvalidTypeException ( sprintf ( 'Invalid type for path "%s". Expected closure, but got %s.' , $ this -> getPath ( ) , gettype ( $ value ) ) ) ; if ( $ hint = $ this -> getInfo ( ) ) { $ exception -...
Validates the type of a Node .
240,890
private function addProcessInfo ( Process $ process , Project $ project ) { $ this -> processes [ $ project -> getName ( ) ] = [ 'process' => $ process , 'project' => $ project , ] ; }
Adds the process and project info .
240,891
private function workaroundForSingleChar ( string & $ incrementalOutput , Project $ project ) { if ( ! empty ( $ this -> tmpChar [ $ project -> getName ( ) ] ) && ! empty ( $ incrementalOutput ) ) { $ incrementalOutput = $ this -> tmpChar [ $ project -> getName ( ) ] . $ incrementalOutput ; $ this -> tmpChar [ $ projec...
Workaround for single char .
240,892
protected function handleProcessOutput ( array $ processInfo , BufferedOutputInterface $ output , callable $ processTerminatedCallback ) { $ process = $ processInfo [ 'process' ] ; $ project = $ processInfo [ 'project' ] ; if ( ! $ process -> isStarted ( ) ) { $ process -> start ( ) ; } $ incrementalOutput = $ this -> ...
Handles the output for a process .
240,893
public function get ( $ keyName , $ defaultValue = null ) { $ this -> initList ( ) ; $ keyName = strtolower ( $ keyName ) ; if ( empty ( $ this -> list [ $ keyName ] ) ) { return $ defaultValue ; } return $ this -> list [ $ keyName ] ; }
Gets value of by key name .
240,894
private function generateSwitchResponse ( $ client , $ request ) { $ acceptHeader = sha1 ( $ request -> getHeader ( "sec-websocket-key" ) . self :: WEBSOCKET_GUID , true ) ; $ switchParams = array ( "Upgrade" => "websocket" , "Connection" => "Upgrade" , "Sec-WebSocket-Accept" => base64_encode ( $ acceptHeader ) ) ; $ r...
Generates WebSocket upgrade response & notifies clients handler
240,895
private function verifyUpgradeRequest ( HttpRequest $ request ) { $ this -> logger -> debug ( "Attempting to switch protocols (checking preconditions per RFC)" ) ; if ( $ request -> getMethod ( ) !== "GET" ) { throw new HttpException ( "Cannot upgrade to WebSocket - invalid method" , HttpCode :: METHOD_NOT_ALLOWED ) ; ...
Validates HTTP = > WebSocket upgrade request
240,896
private function populatePaths ( $ paths ) { if ( ! is_array ( $ paths ) ) { $ paths = array ( $ paths ) ; } foreach ( $ paths as $ path ) { if ( $ path [ 0 ] !== "/" && $ path [ 0 ] !== "*" ) { throw new InvalidArgumentException ( "Invalid handler path specified" ) ; } $ this -> handlerPaths [ ] = $ path ; } }
Verifies & adds paths handled by this handler It s private due to fact that for performance reasons CherryHttp will cache paths for each handler
240,897
public function getBaseTmpDir ( ) { $ folders = explode ( DIRECTORY_SEPARATOR , $ this -> getRootDir ( ) ) ; $ foldersCount = count ( $ folders ) ; $ projectDir = '' ; if ( true === isset ( $ folders [ $ foldersCount - 2 ] ) ) { $ projectDir = $ folders [ $ foldersCount - 2 ] ; } $ tempDirPath = FileUtility :: getUserB...
Get Base Tmp Dir
240,898
public function describe ( $ serviceId ) { $ cache = $ this -> getCache ( ) ; $ cacheId = self :: CACHE_ID_PREFIX . $ serviceId ; if ( $ cache && ( $ description = $ this -> getCache ( ) -> getItem ( $ cacheId ) ) ) { return $ description ; } $ loader = $ this -> getServiceLoader ( ) ; $ options = $ loader -> getServic...
Retrieve service description
240,899
public function get ( $ html ) { $ kernel_dir = $ this -> kerneldir ; require __DIR__ . "/../Resources/config/dompdf.php" ; $ this -> pdf = new DOMPDF ; foreach ( $ this -> options as $ optionKey => $ optionValue ) { $ this -> pdf -> set_option ( $ optionKey , $ optionValue ) ; } $ this -> pdf -> load_html ( $ html ) ;...
Get PDF By HTML