idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
239,500
public function moveDown ( $ entity ) { extract ( $ this -> _config ) ; $ next = $ model :: find ( 'first' , [ 'conditions' => [ $ parent => $ entity -> $ parent , $ left => $ entity -> $ right + 1 ] ] ) ; if ( $ next !== null ) { $ spanToZero = $ entity -> $ right ; $ rangeX = [ 'floor' => $ entity -> $ left , 'ceilin...
Moves an element down in order
239,501
public function moveUp ( $ entity ) { extract ( $ this -> _config ) ; $ prev = $ model :: find ( 'first' , [ 'conditions' => [ $ parent => $ entity -> $ parent , $ right => $ entity -> $ left - 1 ] ] ) ; if ( ! $ prev ) { return true ; } $ spanToZero = $ entity -> $ right ; $ rangeX = [ 'floor' => $ entity -> $ left , ...
Moves an element up in order
239,502
protected function _getPosition ( $ entity , $ childrenCount = false ) { extract ( $ this -> _config ) ; $ parent = $ this -> _getById ( $ entity -> $ parent ) ; if ( $ entity -> $ left === ( $ parent -> $ left + 1 ) ) { return 0 ; } if ( ( $ entity -> $ right + 1 ) === $ parent -> $ right ) { if ( $ childrenCount === ...
Returns the current position number of an element at the same level where 0 is first position
239,503
public function queueStatus ( $ manager ) { $ socket = $ this -> getSocket ( $ manager ) ; $ stream = $ socket -> getStream ( ) ; $ stream -> send ( new QueueStatusRequest ( ) ) ; $ msg = $ stream -> read ( new TimeoutTimer ( 1500 ) ) ; if ( ! $ msg instanceof QueueStatusResponse ) { throw new RuntimeException ( 'Inval...
Requests the queue status .
239,504
public function optimize ( stdClass $ data ) { $ data -> formValidationName = $ data -> serviceName . 'Validator' ; $ data -> formValidationNameSpace = str_replace ( '\\http\\controllers' , '\\validators' , $ data -> controllerNamespace ) ; $ data -> formValidationDestination = str_replace ( '/http/controllers' , '/val...
Optimizing configuration for form creation
239,505
public function generate ( stdClass $ data ) { $ files = [ ] ; $ this -> createFileFromTemplate ( [ "destination" => $ data -> formValidationDestination , "templateDestination" => __DIR__ . '/../templates/service/validator.hctpl' , "content" => [ "formValidationNameSpace" => $ data -> formValidationNameSpace , "formVal...
Generating validator files
239,506
public static function getConsoleDir ( ) { $ rootDir = sprintf ( '%s/../../../../../../../..' , __DIR__ ) ; $ paths = [ 'bin' , 'app' , ] ; foreach ( $ paths as $ path ) { $ fullPath = sprintf ( '%s/%s' , $ rootDir , $ path ) ; if ( true === is_dir ( $ fullPath ) && true === file_exists ( sprintf ( '%s/console' , $ ful...
Get Console Dir
239,507
public static function start ( $ name ) { $ status = self :: status ( $ name ) ; if ( $ status == self :: STOPPED ) { return self :: runCommand ( 'start' , [ $ name ] ) -> isSuccessful ( ) ; } return $ status == Machine :: RUNNING ; }
Start a machine .
239,508
public static function getEnv ( $ name ) { $ envs = [ ] ; $ output = self :: runCommand ( 'env' , [ $ name ] ) ; if ( trim ( $ output -> getOutput ( ) ) == "$name is not running. Please start this with docker-machine start $name" ) { throw new \ Exception ( 'Docker machine has not been started yet.' ) ; } $ envOutput =...
Returns an array of the environment for the Docker client .
239,509
public function buildView ( FormView $ view , FormInterface $ form , array $ options ) { $ parentData = $ form -> getParent ( ) -> getData ( ) ; if ( $ parentData !== null ) { $ accessor = PropertyAccess :: getPropertyAccessor ( ) ; $ url = $ accessor -> getValue ( $ parentData , $ options [ 'image_path' ] ) ; if ( $ u...
Pass the image url to the view
239,510
public function index ( $ area = null , $ locale = null ) { return $ this -> processor -> index ( $ this , ! is_null ( $ area ) ? $ area : area ( ) , $ locale ) ; }
index default action
239,511
public function setApplication ( ApplicationContract $ application = null ) { $ this -> application = $ application ; if ( $ application ) { $ this -> setHelperSet ( $ application -> getHelperSet ( ) ) ; } else { $ this -> helperSet = null ; } }
Sets the ApplicationContract instance .
239,512
public function Subscriber_Update ( $ user_id , $ subscription_state , $ division , $ attributes , $ allow_resubscribe = true , $ append = false ) { $ data = $ this -> _package_subscriber_elements ( $ subscription_state , $ division , $ attributes ) ; if ( is_null ( $ allow_resubscribe ) === false ) { $ data -> allowRe...
Update an existing subscriber .
239,513
public function Subscriber_Get_Id ( $ attributes ) { try { $ ret = $ this -> Subscriber_Lookup ( $ attributes ) ; $ uri = $ ret -> uri ; $ id = ( int ) substr ( strrchr ( $ uri , '/' ) , 1 ) ; } catch ( \ Exception $ e ) { if ( $ e -> getCode ( ) === 404 ) { $ id = false ; } else { throw $ e ; } } return $ id ; }
Look up the id of an existing subscriber .
239,514
public function Subscriber_Retrieve ( $ attributes , $ division ) { $ ret = false ; $ subscriberId = $ this -> Subscriber_Get_Id ( $ attributes ) ; if ( $ subscriberId !== false ) { $ ret = $ this -> _call_api ( 'get' , "{$this->_url}/subscribers/$subscriberId" , array ( 'division' => $ division ) ) ; } return $ ret ; ...
Retrieve all information about a subscriber including attributes division subscription status etc .
239,515
public function Subscribe_And_Send ( $ subscription_state , $ division , $ attributes , $ allow_resubscribe , $ masterId ) { $ data = new \ stdClass ( ) ; $ subscriber = $ this -> _package_subscriber_elements ( $ subscription_state , $ division , $ attributes ) ; if ( is_bool ( $ allow_resubscribe ) === true ) { $ subs...
Subscribe and send
239,516
public function Status_Get ( $ guid , $ nowait = true ) { if ( $ nowait === true ) { $ ret = $ this -> _call_api ( 'get' , "{$this->_url}/statusNoWait/$guid" , array ( ) ) ; } else { do { $ ret = $ this -> _call_api ( 'get' , "{$this->_url}/status/$guid" , array ( ) ) ; switch ( $ ret -> statusCode ) { case 'COMPLETED'...
Get the status of an outstanding request .
239,517
public function Master_Create ( $ envelope , $ targeting , $ scheduling ) { $ ret = false ; $ data = $ this -> _package_master_elements ( $ envelope , $ targeting , $ scheduling ) ; if ( $ data !== false ) { $ ret = $ this -> _call_api ( 'post' , "{$this->_url}/masters" , $ data ) ; } return $ ret ; }
Create a new Master
239,518
public function Master_Update ( $ masterId , $ envelope , $ targeting , $ scheduling ) { $ ret = false ; $ data = $ this -> _package_master_elements ( $ envelope , $ targeting , $ scheduling ) ; if ( $ data !== false ) { $ ret = $ this -> _call_api ( 'put' , "{$this->_url}/masters/$masterId" , $ data ) ; } return $ ret...
Update an existing Master
239,519
public function Master_Get ( $ masterId ) { $ ret = false ; if ( is_int ( $ masterId ) === true ) { try { $ ret = $ this -> _call_api ( 'get' , "{$this->_url}/masters/$masterId" , array ( ) ) ; $ ret = $ this -> _Type_Safe_Yesmail_Master ( $ ret ) ; $ ret -> id = ( int ) $ masterId ; } catch ( \ Exception $ e ) { if ( ...
Get an existing Master
239,520
public function Master_Get_By_Name ( $ masterName ) { $ ret = false ; if ( is_string ( $ masterName ) === true ) { $ pageSize = 50 ; $ begin = 1 ; $ end = $ pageSize ; $ filter = 'active' ; $ more = true ; while ( $ more ) { $ res = $ this -> _call_api ( 'get' , "{$this->_url}/masters" , array ( 'begin' => $ begin , 'e...
Get an existing Master by name
239,521
public function Master_Post_Run_Count ( $ masterId ) { $ ret = false ; if ( is_int ( $ masterId ) === true ) { $ ret = $ this -> _call_api ( 'post' , "{$this->_url}/masters/$masterId/RUN/countData" , array ( ) ) ; } return $ ret ; }
Submit the master s ID and RUN the eAPI service URL to request the the count job for a specific master Run this before doing Master_Post_Run_Count
239,522
public function Master_Get_Count ( $ masterId ) { $ ret = false ; if ( is_int ( $ masterId ) === true ) { do { $ ret = $ this -> _call_api ( 'get' , "{$this->_url}/masters/$masterId/countData" , array ( ) ) ; sleep ( 15 ) ; } while ( ! $ this -> Status_Is_Completed ( $ ret -> status ) ) ; } return $ ret ; }
Get the number of active subscribers based on master s id . Run this after doing Master_Post_Run_Count
239,523
public function Master_Assets_Get ( $ masterId ) { $ ret = false ; if ( is_int ( $ masterId ) === true ) { $ ret = $ this -> _call_api ( 'get' , "{$this->_url}/masters/$masterId/assets" , array ( ) ) ; } return $ ret ; }
Get the assets that belong to a Master
239,524
public function Master_Preview ( $ masterId , $ contentType , $ distributionList , $ userId , $ emails ) { $ ret = false ; $ contentTypes = array ( 'HTML' , 'PLAIN' , 'BOTH' , 'USERPREFERENCE' ) ; if ( in_array ( $ contentType , $ contentTypes ) === true ) { if ( is_string ( $ distributionList ) === true xor ( is_int (...
Provides a way to preview a message by sending it to a group of email addresses following the same semantics as the preview functionality within the Enterprise Application .
239,525
public function ListManagement_Get_Lists ( $ type ) { $ ret = false ; if ( is_string ( $ type ) === true ) { $ type = rawurlencode ( $ type ) ; $ ret = $ this -> _call_api ( 'get' , "{$this->_url}/lists/$type" , array ( ) ) ; } return $ ret ; }
Get a list of lists given a list type
239,526
public function ListManagement_Update_List ( $ modifyList ) { $ ret = false ; if ( $ modifyList instanceof \ Yesmail \ YesmailListManagementModifyList && $ modifyList -> is_valid ( ) === true ) { $ name = rawurlencode ( $ modifyList -> name ) ; $ type = rawurlencode ( $ modifyList -> type ) ; $ ret = $ this -> _call_ap...
Either remove or append the subscribers identified in the payload . For subscriberIds and emails that are submitted as part of a request that cannot be mapped back to existing subscriber data are ignored and a total count of the number added users is returned as part of the status message .
239,527
public function ListManagement_Create_List ( $ modifyList ) { $ ret = false ; if ( $ modifyList instanceof \ Yesmail \ YesmailListManagementModifyList && $ modifyList -> is_valid ( ) === true ) { $ ret = $ this -> _call_api ( 'post' , "{$this->_url}/lists/{$modifyList->type}" , $ modifyList ) ; } return $ ret ; }
Create a new list of the given type
239,528
protected function _package_master_elements ( $ envelope , $ targeting , $ scheduling ) { $ ret = false ; if ( $ envelope instanceof \ Yesmail \ YesmailMasterEnvelope && $ envelope -> is_valid ( ) === true ) { $ ret = new \ stdClass ( ) ; $ ret -> envelope = $ envelope ; if ( $ targeting instanceof \ Yesmail \ YesmailM...
Package a Master s envelope targeting and scheduling for sending in a request
239,529
protected function _call_api ( $ method , $ url , $ params ) { $ raw_response = $ this -> _client -> $ method ( $ url , $ params ) ; $ info = $ this -> _client -> get_info ( ) ; if ( $ info [ 'http_code' ] != null ) { switch ( $ info [ "http_code" ] ) { case 200 : case 202 : $ response = json_decode ( $ raw_response ) ...
Make a call to the Yesmail API
239,530
public function getSecondsAsText ( $ seconds , $ decimals = 2 , $ decPoint = ',' , $ thousandsSep = '.' ) { $ seconds = floatval ( $ seconds ) ; if ( 60 > $ seconds ) { return sprintf ( '%ss' , number_format ( $ seconds , $ decimals , $ decPoint , $ thousandsSep ) ) ; } $ minutes = floor ( $ seconds / 60 ) ; if ( 3600 ...
Get Seconds As Text
239,531
public function getSecondsAsTextExtended ( $ seconds ) { $ seconds = floatval ( $ seconds ) ; $ result = [ ] ; $ steps = [ 'days' => 86400 , 'hours' => 3600 , 'minutes' => 60 , 'seconds' => 1 , ] ; foreach ( $ steps as $ stepName => $ stepDivider ) { $ stepCount = floor ( $ seconds / $ stepDivider ) ; if ( 0 < $ stepCo...
Get Seconds As Text Extended
239,532
protected function validate ( ) { if ( $ this -> method === HttpMethods :: POST && empty ( $ this -> data ) ) { throw new Exceptions \ WebException ( "Using method POST without data." ) ; } }
Validates the request values for correctness
239,533
protected function prepareCurl ( ) { $ this -> curl = curl_init ( ) ; $ this -> complete = Complete :: factory ( function ( ) { if ( $ this -> curl ) { curl_close ( $ this -> curl ) ; } $ this -> curl = null ; $ this -> complete = null ; } ) ; foreach ( self :: $ curlOptions as $ option => $ value ) { curl_setopt ( $ t...
Initializes the curl resource
239,534
protected function prepareData ( ) { if ( ! empty ( $ this -> data ) ) { if ( $ this -> method === HttpMethods :: GET ) { $ this -> url = Utils :: appendUrlQuery ( $ this -> url , $ this -> data ) ; } else if ( $ this -> method === HttpMethods :: POST ) { curl_setopt ( $ this -> curl , CURLOPT_POSTFIELDS , $ this -> da...
Adds the data value to the curl request
239,535
protected function prepareHeaders ( ) { if ( $ this -> method === HttpMethods :: POST && ! empty ( $ this -> headers [ "Content-Type" ] ) ) { unset ( $ this -> headers [ "Content-Type" ] ) ; } curl_setopt ( $ this -> curl , CURLOPT_USERAGENT , $ this -> userAgent ) ; if ( ! empty ( $ this -> headers ) ) { $ headers = $...
Adds the set headers to the curl request
239,536
protected function exec ( ) { curl_setopt ( $ this -> curl , CURLOPT_URL , $ this -> url ) ; $ response_text = curl_exec ( $ this -> curl ) ; $ this -> info = curl_getinfo ( $ this -> curl ) ; $ this -> logInformation ( ) ; if ( false === $ response_text ) { throw new Exceptions \ WebException ( curl_error ( $ this -> ...
Executes the configured request
239,537
protected function logInformation ( ) { if ( $ this -> logger ) { $ level = $ this -> info [ "http_code" ] > 0 && $ this -> info [ "http_code" ] < 400 ? LogLevel :: INFO : LogLevel :: ERROR ; $ this -> info [ "method" ] = $ this -> method ; $ this -> logger -> log ( $ level , $ this -> logFormat , $ this -> info ) ; } ...
Logs request information when logging is enabled
239,538
public function Allow ( $ range ) { $ formatted = $ this -> formatRange ( $ range ) ; if ( ! $ formatted ) { return FALSE ; } $ this -> allowIPs [ $ formatted [ 0 ] ] = $ formatted [ 1 ] ; return TRUE ; }
Add an IP address range to allow Return FALSE is the IP range is invalid
239,539
public function Deny ( $ range ) { $ formatted = $ this -> formatRange ( $ range ) ; if ( ! $ formatted ) { return FALSE ; } $ this -> denyIPs [ $ formatted [ 0 ] ] = $ formatted [ 1 ] ; return TRUE ; }
Add an IP address range to deny Return FALSE is the IP range is invalid
239,540
public function removeAllowed ( $ range ) { $ formatted = $ this -> formatRange ( $ range ) ; if ( ! $ formatted ) { return FALSE ; } unset ( $ this -> allowIPs [ $ formatted [ 0 ] ] ) ; return TRUE ; }
Remove an allowed IP address range Return FALSE is the IP range is invalid
239,541
public function removeDenied ( $ range ) { $ formatted = $ this -> formatRange ( $ range ) ; if ( ! $ formatted ) { return FALSE ; } unset ( $ this -> denyIPs [ $ formatted [ 0 ] ] ) ; return TRUE ; }
Remove a denied IP address range Return FALSE is the IP range is invalid
239,542
public function formatRange ( $ range ) { if ( strpos ( $ range , '/' ) !== FALSE ) { list ( $ ip , $ netmask ) = explode ( '/' , $ range , 2 ) ; $ ip = implode ( '.' , array_pad ( explode ( '.' , $ ip ) , 4 , 0 ) ) ; if ( strpos ( $ netmask , '.' ) !== FALSE ) { $ netmask = str_replace ( '*' , '0' , $ netmask ) ; $ ip...
Format an IP address range
239,543
protected function isInside ( $ ip , $ name , $ range ) { if ( ! is_array ( $ range ) ) { if ( $ ip == $ range ) { return TRUE ; } } elseif ( strpos ( $ name , '/' ) !== FALSE ) { if ( ( $ ip & $ range [ 1 ] ) == ( $ range [ 0 ] & $ range [ 1 ] ) ) { return TRUE ; } } elseif ( strpos ( $ name , '-' ) !== FALSE ) { if (...
Return whether an IP is inside a range
239,544
public function isAllowed ( $ ip , $ priority = 'deny,allow' ) { $ ipDec = ( float ) sprintf ( "%u" , ip2long ( $ ip ) ) ; foreach ( explode ( ',' , $ priority ) as $ type ) { switch ( $ type ) { case 'allow' : foreach ( $ this -> allowIPs as $ name => $ range ) { if ( $ this -> isInside ( $ ipDec , $ name , $ range ) ...
Return whether an IP is allowed
239,545
protected function row ( $ worker , $ service , $ current , $ ready , $ valid ) { $ mask = "| %-10.10s | %-40.40s | %-40.40s | %-5s | %-5s |" ; $ text = sprintf ( $ mask , $ worker , $ service , $ current , $ ready , $ valid ) ; $ this -> output -> writeln ( $ text ) ; }
Print a single line with information .
239,546
protected static function parseValidKeys ( ) { if ( self :: $ validOptions !== null ) { return ; } $ refl = new ReflectionClass ( '\ZMQ' ) ; $ const = $ refl -> getConstants ( ) ; self :: $ validOptions = array ( ) ; foreach ( $ const as $ key => $ value ) { if ( substr ( $ key , 0 , 8 ) == 'SOCKOPT_' ) { self :: $ val...
Fills the attribute validOptions containing a list of options that can be set .
239,547
public function isOptionKeyValid ( $ key ) { self :: parseValidKeys ( ) ; if ( isset ( self :: $ validOptions [ $ key ] ) ) { return true ; } return false ; }
Checks if the given option key is valid for ZMQ .
239,548
public function addOption ( $ key , $ value ) { if ( ! $ this -> isOptionKeyValid ( $ key ) ) { throw new \ RuntimeException ( 'Invalid socket option ' . $ key . '.' ) ; } $ this -> options [ $ key ] = $ value ; return $ this ; }
Overrides a default ZMQ option .
239,549
public function addOptions ( $ options ) { foreach ( $ options as $ key => $ value ) { $ this -> addOption ( $ key , $ value ) ; } return $ this ; }
Adds ZMQ socket options .
239,550
public function createPublisher ( $ mode , $ dsn = null , $ options = array ( ) ) { return $ this -> createSocket ( ZMQ :: SOCKET_PUB , $ mode , $ dsn , $ options ) ; }
Creates a publiser socket .
239,551
public function createSubscriber ( $ mode , $ dsn = null , $ subscribe = '' , $ options = array ( ) ) { $ options [ ZMQ :: SOCKOPT_SUBSCRIBE ] = $ subscribe ; return $ this -> createSocket ( ZMQ :: SOCKET_SUB , $ mode , $ dsn , $ options ) ; }
Creates a subscriber socket .
239,552
public function createRequest ( $ mode , $ dsn = null , $ options = array ( ) ) { return $ this -> createSocket ( ZMQ :: SOCKET_REQ , $ mode , $ dsn , $ options ) ; }
Creates a request socket .
239,553
public function createReply ( $ mode , $ dsn = null , $ options = array ( ) ) { return $ this -> createSocket ( ZMQ :: SOCKET_REP , $ mode , $ dsn , $ options ) ; }
Creates a reply socket .
239,554
public function createRouter ( $ mode , $ dsn = null , $ options = array ( ) ) { return $ this -> createSocket ( ZMQ :: SOCKET_ROUTER , $ mode , $ dsn , $ options ) ; }
Creates a router socket .
239,555
protected function createSocket ( $ type , $ mode , $ dsn = null , $ options = array ( ) ) { $ context = $ this -> getContext ( ) ; $ socket = new Socket ( $ context , $ type ) ; $ options = $ this -> options + $ options ; foreach ( $ options as $ key => $ value ) { $ socket -> setSockOpt ( $ key , $ value ) ; } $ this...
Creates a socket .
239,556
public function connect ( ZMQSocket $ socket , $ mode , $ dsn ) { if ( $ mode == self :: MODE_CONSTRUCT ) { return $ this ; } $ func = null ; if ( $ mode == self :: MODE_BIND ) { $ func = 'bind' ; } elseif ( $ mode == self :: MODE_CONNECT ) { $ func = 'connect' ; } if ( is_string ( $ dsn ) ) { $ dsn = array ( $ dsn ) ;...
Connects or binds a socket based on mode .
239,557
public function registerMediaDomain ( $ extensions , DomainInterface $ mediaDomain ) { foreach ( ( array ) $ extensions as $ extensions ) { $ this -> mediaDomainsMap [ strtolower ( $ extensions ) ] = $ mediaDomain ; } }
Register a media domain for given file extension set .
239,558
private function fetchDomain ( $ extension ) { if ( ! array_key_exists ( $ extension = strtolower ( $ extension ) , $ this -> mediaDomainsMap ) ) { throw new UnsupportedFileException ( sprintf ( 'Extension ".%s" isnt supported by Media component, only ["%s"] are.' , $ extension , implode ( '", "' , array_keys ( $ this ...
Fetch and return domain matching given file extension .
239,559
public function can ( $ permission , array $ params = [ ] , $ caching = true ) { return $ this -> canAccess ( $ permission , $ params , $ caching ) ; }
check user permission
239,560
public static function get ( $ dottedKey , $ default = null ) { if ( self :: $ flashedVars ) { $ flashedValue = Arr :: get ( self :: $ flashedVars , $ dottedKey , '~no~flashed~value~' ) ; if ( $ flashedValue !== '~no~flashed~value~' ) { return $ flashedValue ; } } return self :: $ storage -> get ( $ dottedKey , $ defau...
Retrieve the value from session .
239,561
public function addLogHandler ( array $ logHandlers , $ createLogger = false ) { try { $ this -> configuredLogHandlers = array_merge ( $ this -> configuredLogHandlers , $ logHandlers ) ; if ( $ createLogger === true ) { $ this -> createLogger ( $ this -> channelName ) ; $ this -> createLogHandlers ( ) ; } } catch ( Exc...
Add log handlers to the configuration
239,562
protected function createLogHandlers ( ) { $ logHandlers = $ this -> configuredLogHandlers ; foreach ( $ logHandlers as $ handlerNamespace => $ handlerDetails ) { if ( is_array ( $ handlerDetails ) && array_key_exists ( 'handler_parameters' , $ handlerDetails ) ) { $ handlerParameters = $ handlerDetails [ 'handler_para...
Iterate the configured log handlers and create concrete handlers
239,563
private static function _getLoggerStderr ( ) { if ( ! isset ( self :: $ loggerStderr ) ) { $ CymapgtStderrLogger = new MonologLogger ( 'cymapgt_stderr' ) ; $ CymapgtStderrLogger -> pushHandler ( new ErrorLogHandler ( ) ) ; self :: $ loggerStderr = $ CymapgtStderrLogger ; } return self :: $ loggerStderr ; }
return the stderr logger
239,564
private static function _getLoggerLevel1 ( $ loggerParams ) { if ( ! isset ( self :: $ loggerLevel1 ) ) { $ CymapgtLevel1LogDir = $ loggerParams [ 'log_dir' ] ; $ CymapgtLevel1Stream = new StreamHandler ( $ CymapgtLevel1LogDir , MonologLogger :: DEBUG ) ; $ CymapgtLevel1Logger = new MonologLogger ( 'cymapgt_level1' ) ;...
return the level1 logger
239,565
private static function _getLoggerLevel2 ( $ loggerParams ) { if ( ! isset ( self :: $ loggerLevel2 ) ) { $ CymapgtLevel2LogDir = $ loggerParams [ 'log_dir' ] ; $ CymapgtLevel2Stream = new StreamHandler ( $ CymapgtLevel2LogDir , MonologLogger :: ERROR ) ; $ CymapgtLevel2Logger = new MonologLogger ( 'cymapgt_level2' ) ;...
return the level2 logger
239,566
private static function _getLoggerLevel3 ( $ loggerParams ) { if ( ! isset ( self :: $ loggerLevel3 ) ) { $ notifierObj = new NotifierSmsAfricasTalkingService ( $ loggerParams [ 'notifier_params' ] , true ) ; $ recipientList = $ loggerParams [ 'notifier_recipients' ] ; $ CymapgtLevel3LogDir = $ loggerParams [ 'log_dir'...
return the level3 logger
239,567
private static function _getLoggerSecurity ( $ loggerParams ) { if ( ! isset ( self :: $ loggerSecurity ) ) { $ notifierObj = new NotifierSmsAfricasTalkingService ( ( $ loggerParams [ 'notifier_params' ] ) , ( $ loggerParams [ 'notifier_params' ] [ 'IS_BEHIND_PROXY' ] ) ) ; $ recipientList = $ loggerParams [ 'notifier_...
return the security logger
239,568
public function setProperties ( $ propValues ) { foreach ( $ propValues as $ propName => $ propValue ) { if ( property_exists ( $ this , $ propName ) ) { $ this -> { $ propName } = $ propValue ; } else { $ this -> throwException ( 'Property "%propName%" does not exist in class "%className%"' , array ( '%propName%' => $...
Sets properties values
239,569
public static function batch ( ClientInterface $ client , $ requests , array $ options = [ ] ) { $ hash = new \ SplObjectStorage ( ) ; foreach ( $ requests as $ request ) { $ hash -> attach ( $ request ) ; } ( new self ( $ client , $ requests , RequestEvents :: convertEventArray ( $ options , [ 'end' ] , [ 'priority' =...
Sends multiple requests in parallel and returns an array of responses and exceptions that uses the same ordering as the provided requests .
239,570
public static function send ( ClientInterface $ client , $ requests , array $ options = [ ] ) { $ pool = new self ( $ client , $ requests , $ options ) ; $ pool -> wait ( ) ; }
Creates a Pool and immediately sends the requests .
239,571
private function addNextRequests ( ) { $ limit = max ( $ this -> getPoolSize ( ) - count ( $ this -> waitQueue ) , 0 ) ; while ( $ limit -- ) { if ( ! $ this -> addNextRequest ( ) ) { break ; } } }
Add as many requests as possible up to the current pool limit .
239,572
private function addNextRequest ( ) { add_next : if ( $ this -> isRealized || ! $ this -> iter || ! $ this -> iter -> valid ( ) ) { return false ; } $ request = $ this -> iter -> current ( ) ; $ this -> iter -> next ( ) ; if ( ! ( $ request instanceof RequestInterface ) ) { throw new \ InvalidArgumentException ( sprint...
Adds the next request to pool and tracks what requests need to be dereferenced when completing the pool .
239,573
public function handle ( ServerRequestInterface $ request ) : ResponseInterface { $ input = $ this -> input ( $ request ) ; $ payload = $ this -> domain -> payload ( $ input ) ; return $ this -> responder -> response ( $ request , $ payload ) ; }
Return a response by following the action domain responder pattern .
239,574
private function input ( ServerRequestInterface $ request ) : array { if ( ! is_null ( $ this -> parser ) ) { $ input = ( $ this -> parser ) ( $ request ) ; if ( is_array ( $ input ) ) { return $ input ; } throw new InputTypeException ( $ input ) ; } return array_merge ( $ request -> getAttributes ( ) , $ request -> ge...
Return an input array from the given request using the request parser .
239,575
public function getStores ( $ langCode = null ) { $ stores = array ( ) ; foreach ( Mage :: app ( ) -> getWebsites ( ) as $ website ) { $ stores = array_replace ( $ stores , $ this -> getWebsiteStores ( $ website , $ langCode ) ) ; } return $ stores ; }
Return an array of stores and attach a language code to them Varien_Object style
239,576
public function getWebsiteStores ( $ website , $ langCode = null ) { $ stores = array ( ) ; $ config = Mage :: helper ( 'radial_core' ) -> getConfigModel ( ) ; $ website = Mage :: app ( ) -> getWebsite ( $ website ) ; foreach ( $ website -> getGroups ( ) as $ group ) { foreach ( $ group -> getStores ( ) as $ store ) { ...
Return an array of stores for the given website and attach a language code to them Varien_Object style
239,577
public function getLanguageCodesList ( ) { $ languages = array ( ) ; foreach ( $ this -> getStores ( ) as $ store ) { $ languages [ ] = $ store -> getLanguageCode ( ) ; } return array_unique ( $ languages ) ; }
Get a simple array of all language codes used in this installation
239,578
public function redirectToRoute ( ) { if ( $ this -> getRequest ( ) -> isXmlHttpRequest ( ) ) { return [ 'redirect' => call_user_func_array ( [ $ this -> url ( ) , 'fromRoute' , ] , func_get_args ( ) ) , ] ; } return call_user_func_array ( [ $ this -> redirect ( ) , 'toRoute' , ] , func_get_args ( ) ) ; }
Redirect to a route or pass the url to the view for a javascript redirect
239,579
protected function fetchFromArray ( array $ array , string $ index = '' , $ xss_clean = false ) { if ( ! array_key_exists ( $ index , $ array ) ) { return false ; } if ( $ xss_clean === 'isset' ) { return array_key_exists ( $ index , $ array ) ; } return $ array [ $ index ] ; }
The function that will handle getting the data from the arrays .
239,580
protected function keyIsAlreadyInstalled ( ) { $ key = 'APP_KEY=base64:' ; $ output = $ this -> execSSH ( "cd $this->domain;cat .env" ) ; if ( str_contains ( $ output , $ key ) ) { return true ; } return false ; }
Key is already installed on production?
239,581
public function getRouteInfo ( ) { if ( $ this -> isSingle ( ) ) { if ( isset ( $ this -> containers [ 'route_info' ] ) && ( $ controller = $ this -> containers [ 'route_info' ] -> get ( 'controller' ) ) && ( $ action = $ this -> containers [ 'route_info' ] -> get ( 'action' ) ) ) { return [ 'controller' => $ controlle...
Get Route Info
239,582
public function isHome ( ) { if ( $ this -> isSingle ( ) ) { if ( isset ( $ this -> containers [ 'route_info' ] ) ) { $ home_controller = 'index' ; $ home_action = 'index' ; $ home = $ this -> getHome ( ) ; if ( $ home && isset ( $ home [ 'controller' ] ) && isset ( $ home [ 'action' ] ) && $ home [ 'controller' ] && $...
If is home
239,583
public function getHomeUri ( ) { $ homeUri = '' ; if ( $ this -> isSingle ( ) ) { $ controller = 'index' ; $ action = 'index' ; $ home = $ this -> getHome ( ) ; if ( isset ( $ home [ 'controller' ] ) && isset ( $ home [ 'action' ] ) && $ home [ 'controller' ] && $ home [ 'action' ] ) { $ controller = $ home [ 'controll...
Get Home Uri
239,584
public function getDb ( $ db_type , $ node_type ) { if ( $ this -> isSingle ( ) ) { switch ( $ db_type ) { case Connection :: DB_TYPE : switch ( $ node_type ) { case 'master' : return Connection :: component ( ) -> write_conn ; case 'slave' : return Connection :: component ( ) -> read_conn ; default : return Connection...
Get Db Connection
239,585
public function createAbsoluteUrl ( $ uri , $ query_params = [ ] , $ ssl = false , $ port = 80 , $ request = null ) { if ( $ this -> isSingle ( ) ) { return UrlManager :: createAbsoluteUrl ( $ uri , $ query_params , $ ssl , $ port , $ request ) ; } return '' ; }
Create Absolute Url
239,586
public function getParam ( $ param_name , $ default_value = null ) { if ( $ this -> isSingle ( ) ) { return RequestKit :: getParam ( $ param_name , $ default_value ) ; } return false ; }
Get Http Request Param Value
239,587
public function import ( $ path ) { if ( $ this -> isSingle ( ) ) { if ( file_exists ( $ path ) && strtolower ( FileHelper :: getExtensionName ( $ path ) ) == 'php' ) { include_once str_replace ( Security :: INSECURE_CODES , '' , $ path ) ; } } }
Import PHP File
239,588
public function swiftSend ( $ from_name , $ receivers , & $ successfulRecipients , & $ failedRecipients , $ subject = '' , $ body = '' , $ content_type = 'text/html' , $ charset = 'UTF-8' ) { if ( $ this -> isSingle ( ) ) { Swift :: component ( ) -> send ( $ from_name , $ receivers , $ successfulRecipients , $ failedRe...
Send Swift Mail
239,589
public function loginRequired ( $ redirect_url , $ request = null , $ response = null ) { if ( $ this -> isSingle ( ) ) { User :: loginRequired ( $ redirect_url , $ request , $ response ) ; } }
Check If Logged In
239,590
public function isAction ( $ request = null ) { $ is_action = false ; if ( $ this -> isSingle ( ) ) { $ queryString = $ request ? $ request -> getQueryString ( ) : Lb :: app ( ) -> getQueryString ( ) ; $ requestUri = $ request ? $ request -> getUri ( ) : Lb :: app ( ) -> getUri ( ) ; if ( Lb :: app ( ) -> isPrettyUrl (...
Detect Action Exists
239,591
public function get_rpc_client ( $ url ) { if ( $ this -> isSingle ( ) ) { include_once Lb :: app ( ) -> getRootDir ( ) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'hprose' . DIRECTORY_SEPARATOR . 'hprose' . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Hprose.php' ; return new \ Hprose \ Http \ Cli...
Get RPC Client
239,592
public function on ( $ event_name , $ listener , $ data = null ) { if ( $ this -> isSingle ( ) ) { BaseObserver :: on ( $ event_name , $ listener , $ data ) ; } }
Register Event Listener
239,593
public function dispatchJob ( $ job , $ data = [ ] , $ handler = 'handler' ) { if ( $ this -> isSingle ( ) ) { if ( ! is_object ( $ job ) ) { $ job = new $ job ; } return call_user_func_array ( [ $ job , $ handler ] , [ 'data' => $ data ] ) ; } return null ; }
Dispatch a job
239,594
protected function loadEnv ( ) { if ( defined ( 'ENV_DIR' ) && file_exists ( ENV_DIR ) ) { if ( defined ( 'ENV_FILE' ) && file_exists ( ENV_FILE ) ) { $ dotenv = new \ Dotenv \ Dotenv ( ENV_DIR , ENV_FILE ) ; } else { $ dotenv = new \ Dotenv \ Dotenv ( ENV_DIR ) ; } $ dotenv -> load ( ) ; } }
Load Environment Variables
239,595
protected function getPageCache ( $ cache_type ) { $ route_info = Lb :: app ( ) -> getRouteInfo ( ) ; $ page_cache_key = implode ( '_' , [ 'page_cache' , $ route_info [ 'controller' ] , $ route_info [ 'action' ] ] ) ; return Lb :: app ( ) -> getCache ( $ page_cache_key , $ cache_type ) ; }
Get Page Cache
239,596
protected function setPageCache ( $ cache_type , $ page_cache , $ expire = 60 ) { $ route_info = Lb :: app ( ) -> getRouteInfo ( ) ; $ page_cache_key = implode ( '_' , [ 'page_cache' , $ route_info [ 'controller' ] , $ route_info [ 'action' ] ] ) ; Lb :: app ( ) -> setCache ( $ page_cache_key , $ page_cache , $ cache_t...
Set Page Cache
239,597
protected function setHttpCache ( $ response = null ) { $ http_cache_config = Lb :: app ( ) -> getHttpCacheConfig ( ) ; if ( isset ( $ http_cache_config [ 'cache_control' ] ) && isset ( $ http_cache_config [ 'offset' ] ) ) { HttpHelper :: setCache ( $ http_cache_config [ 'cache_control' ] , $ http_cache_config [ 'offse...
Set Http Cache
239,598
private function createSession ( $ sid , $ userId , Request $ req ) { $ sessionCookie = session_get_cookie_params ( ) ; $ expires = time ( ) + $ sessionCookie [ 'lifetime' ] ; $ session = new ActiveSession ( ) ; $ session -> id = $ sid ; $ session -> user_id = $ userId ; $ session -> ip = $ req -> ip ( ) ; $ session ->...
Creates an active session for a user .
239,599
private function refreshSession ( $ sid ) { $ sessionCookie = session_get_cookie_params ( ) ; $ expires = time ( ) + $ sessionCookie [ 'lifetime' ] ; $ this -> getDatabase ( ) -> update ( 'ActiveSessions' ) -> where ( 'id' , $ sid ) -> values ( [ 'expires' => $ expires , 'updated_at' => Utility :: unixToDb ( time ( ) )...
Refreshes the expiration on an active session .