idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
59,500
public function create ( $ type , $ override , $ persisted ) { $ base = $ this -> factory -> blueprint ( ) ; $ variation = $ this -> getVariation ( $ type ) ; $ blueprint = array_merge ( $ base , $ variation , $ override ) ; return new Blueprint ( $ this -> name , $ type , $ blueprint , $ this -> isFixture ( $ type ) ,...
Creates a new blueprint
59,501
private function getVariation ( $ type ) { if ( $ type == 'blueprint' ) { return array ( ) ; } elseif ( method_exists ( $ this -> factory , "{$type}Fixture" ) ) { return call_user_func ( array ( $ this -> factory , "{$type}Fixture" ) ) ; } elseif ( method_exists ( $ this -> factory , "{$type}_fixture" ) ) { return call...
Applies a variation to the basic blueprint or calls the fixture
59,502
public function replace ( array $ annotations ) { $ this -> annotations = $ annotations ; $ this -> names = [ ] ; $ index = 0 ; foreach ( $ annotations as $ annotation ) { $ name = $ annotation -> getName ( ) ; if ( ! array_key_exists ( $ name , $ this -> names ) ) { $ this -> names [ $ name ] = [ ] ; } $ this -> names...
Replaces a set of annotations values
59,503
public function get ( $ key ) { if ( $ this -> has ( $ key ) ) { return $ this -> annotations [ $ this -> names [ $ key ] [ 0 ] ] ; } return null ; }
Retrieves a single annotation
59,504
public function find ( $ key , $ filter = null ) { if ( ! $ this -> has ( $ key ) ) { return [ ] ; } $ annotations = [ ] ; foreach ( $ this -> names [ $ key ] as $ index ) { if ( ! is_int ( $ filter ) ) { $ annotations [ ] = $ this -> annotations [ $ index ] ; continue ; } $ annotation = $ this -> annotations [ $ index...
Retrieves a list of annotations by name
59,505
public function filter ( \ Closure $ callback , $ reindex = true ) { $ result = array_filter ( $ this -> annotations , $ callback ) ; if ( $ reindex ) { $ result = array_values ( $ result ) ; } return $ result ; }
Filters elements with the given callback
59,506
protected function checkRequiredModules ( array $ data , & $ result ) { if ( $ data [ 'installer' ] === 'base' && empty ( $ data [ 'step' ] ) && ! $ this -> getModel ( ) -> hasAllRequiredModules ( ) ) { $ result = array ( 'redirect' => '' , 'severity' => 'warning' , 'message' => gplcart_text ( 'You cannot use this inst...
Check if all required modules in place
59,507
public static function create ( int $ statusCode , string $ message , string $ request , string $ response ) : ApiClientException { switch ( $ statusCode ) { case 400 : $ exception = new BadRequestException ( $ message , $ request , $ response ) ; break ; case 401 : $ exception = new UnauthorizedException ( $ message ,...
Creates the exception corresponding to the specified status code .
59,508
public function store ( $ message , $ bucket ) { $ messages = $ this -> fetch ( $ bucket ) ; if ( true === in_array ( $ message , $ messages ) ) { return false ; } $ messages [ ] = $ message ; $ _SESSION [ self :: ROOT_NODE ] [ $ bucket ] = $ messages ; return true ; }
Store the notifications using the driver
59,509
public function fetch ( $ bucket , $ flush = true ) { if ( true === empty ( $ _SESSION [ self :: ROOT_NODE ] ) ) { $ _SESSION [ self :: ROOT_NODE ] = [ ] ; } if ( true === empty ( $ _SESSION [ self :: ROOT_NODE ] [ $ bucket ] ) ) { $ _SESSION [ self :: ROOT_NODE ] [ $ bucket ] = [ ] ; } $ messages = $ _SESSION [ self :...
Fetch the notifications from the driver
59,510
public function flush ( $ bucket ) { if ( false === empty ( $ _SESSION [ self :: ROOT_NODE ] [ $ bucket ] ) ) { $ _SESSION [ self :: ROOT_NODE ] [ $ bucket ] = [ ] ; return true ; } return false ; }
Flush all notifications from the driver
59,511
final protected function addFailureMessage ( string $ messageKey ) : void { $ messages = $ this -> getPossibleMessages ( ) ; if ( ! isset ( $ messages [ $ messageKey ] ) ) { throw new \ RuntimeException ( 'Unknown message key: ' . $ messageKey ) ; } $ this -> failureMessages [ $ messageKey ] = $ messages [ $ messageKey...
Adds a failure message .
59,512
protected function dispatchClassMetadataLoadedEvent ( ClassMetadataInterface $ classMetadata ) : void { if ( null === $ this -> eventDispatcher ) { return ; } $ this -> eventDispatcher -> dispatch ( ClassMetadataLoadedEvent :: LOADED_EVENT , new ClassMetadataLoadedEvent ( $ classMetadata ) ) ; }
Dispatches a class metadata loaded event for the given class .
59,513
private function getFromCache ( string $ class ) : ? ClassMetadataInterface { if ( null === $ this -> cache ) { return null ; } if ( $ this -> cache instanceof Cache ) { $ cached = $ this -> cache -> fetch ( $ class ) ? : null ; } else { $ class = preg_replace ( '#[\{\}\(\)/\\\\@:]#' , '_' , str_replace ( '_' , '__' , ...
Check a cache pool for cached metadata .
59,514
private function saveInCache ( string $ class , ClassMetadataInterface $ classMetadata ) : void { if ( null === $ this -> cache ) { return ; } if ( $ this -> cache instanceof Cache ) { $ this -> cache -> save ( $ class , $ classMetadata ) ; } else { $ class = preg_replace ( '#[\{\}\(\)/\\\\@:]#' , '_' , str_replace ( '...
Saves a metadata into a cache pool .
59,515
private function getClass ( $ value ) { if ( ! is_object ( $ value ) && ! is_string ( $ value ) ) { return false ; } if ( is_object ( $ value ) ) { $ value = get_class ( $ value ) ; } return ltrim ( $ value , '\\' ) ; }
Get the class name from a string or an object .
59,516
public function register ( ) { if ( ! $ this -> isRegistered ) { spl_autoload_register ( [ $ this , 'load' ] , true , true ) ; $ this -> isRegistered = true ; } return $ this ; }
Register the autoloader with spl_autoload .
59,517
public function registerPath ( $ namespace , $ path , $ prepend = false ) { $ namespace = Normalizer :: ns ( $ namespace , true ) ; $ index = substr ( $ namespace , 0 , 4 ) ; $ this -> indexes [ $ index ] = true ; $ path = Normalizer :: path ( $ path , true ) ; if ( ! isset ( $ this -> paths [ $ namespace ] ) ) { $ thi...
Registers a PSR - 4 directory for a given namespace .
59,518
public function addClassMap ( array $ map ) { if ( empty ( $ this -> classMap ) ) { $ this -> classMap = $ map ; return $ this ; } $ this -> classMap = array_merge ( $ this -> classMap , $ map ) ; return $ this ; }
Adds the map of classes .
59,519
public function findFile ( $ class ) { $ class = Normalizer :: ns ( $ class , false ) ; if ( isset ( $ this -> classMap [ $ class ] ) ) { return $ this -> classMap [ $ class ] ; } $ index = substr ( $ class , 0 , 4 ) ; if ( isset ( $ this -> indexes [ $ index ] ) ) { $ namespace = $ class ; while ( false !== $ pos = st...
Finds the path to the file that contains the specified class .
59,520
public function setEntityFormat ( $ format ) { $ this -> validator -> isFormatValid ( $ format ) ; $ this -> entityFormat = $ format ; return $ this ; }
Sets the entity type format .
59,521
public function setFieldKeyFormat ( $ format ) { $ this -> validator -> isFormatValid ( $ format ) ; $ this -> fieldKeyFormat = $ format ; return $ this ; }
Sets the field key format .
59,522
public function getFeatures ( ) { $ featuresString = $ this -> storage -> get ( $ this -> getFeaturesKey ( ) ) ; $ features = explode ( ',' , $ featuresString ) ; return $ features ; }
Get all feature names
59,523
protected function saveFeature ( RolloutableInterface $ feature ) { $ this -> storage -> set ( $ this -> getKey ( $ feature -> getName ( ) ) , ( string ) $ feature ) ; $ features = $ this -> getFeatures ( ) ; if ( false === in_array ( $ feature -> getName ( ) , $ features ) ) { $ features [ ] = $ feature -> getName ( )...
Saves a feature to the storage
59,524
public function activateRole ( $ featureName , $ roleName ) { $ feature = $ this -> getFeature ( $ featureName ) ; $ feature -> addRole ( $ roleName ) ; $ this -> saveFeature ( $ feature ) ; }
Activates a feature for a specific role
59,525
public function deactivateRole ( $ featureName , $ roleName ) { $ feature = $ this -> getFeature ( $ featureName ) ; $ feature -> removeRole ( $ roleName ) ; $ this -> saveFeature ( $ feature ) ; }
Deactivates a feature for a specific role .
59,526
public function activateGroup ( $ featureName , $ groupName ) { $ feature = $ this -> getFeature ( $ featureName ) ; $ feature -> addGroup ( $ groupName ) ; $ this -> saveFeature ( $ feature ) ; }
Activates a feature for a specific group
59,527
public function deactivateGroup ( $ featureName , $ groupName ) { $ feature = $ this -> getFeature ( $ featureName ) ; $ feature -> removeGroup ( $ groupName ) ; $ this -> saveFeature ( $ feature ) ; }
Deactivates a feature for a specific group .
59,528
public function activateUser ( $ featureName , $ userId ) { $ feature = $ this -> getFeature ( $ featureName ) ; $ feature -> addUser ( $ userId ) ; $ this -> saveFeature ( $ feature ) ; }
Activates a feature for a specific user
59,529
public function deactivateUser ( $ featureName , $ userId ) { $ feature = $ this -> getFeature ( $ featureName ) ; $ feature -> removeUser ( $ userId ) ; $ this -> saveFeature ( $ feature ) ; }
Deactivates a feature for a specific user
59,530
public function activatePercentage ( $ featureName , $ percentage ) { $ feature = $ this -> getFeature ( $ featureName ) ; $ feature -> setPercentage ( $ percentage ) ; $ this -> saveFeature ( $ feature ) ; }
Activates a feature for a percentage of users
59,531
public function deactivatePercentage ( $ featureName ) { $ feature = $ this -> getFeature ( $ featureName ) ; $ feature -> setPercentage ( 0 ) ; $ this -> saveFeature ( $ feature ) ; }
Deactivates the percentage activation for a feature
59,532
public function isActive ( $ featureName , DeterminableUserInterface $ user = null ) { $ feature = $ this -> getFeature ( $ featureName ) ; return $ feature -> isActive ( $ this , $ user ) ; }
Checks if a feature is active
59,533
public function userHasRole ( $ roleName , DeterminableUserInterface $ user ) { $ userHasRole = false ; if ( true === in_array ( $ roleName , $ user -> getRoles ( ) ) ) { $ userHasRole = true ; } return $ userHasRole ; }
Checks if a user has the given role
59,534
public function userHasGroup ( $ groupName , DeterminableUserInterface $ user ) { $ userHasGroup = false ; if ( true === in_array ( $ groupName , $ user -> getGroups ( ) ) ) { $ userHasGroup = true ; } return $ userHasGroup ; }
Checks if a user has the given group
59,535
public static function isValid ( $ collection ) { if ( false === is_array ( $ collection ) && false === ( $ collection instanceof Collection ) ) { return false ; } return true ; }
Is Valid Collection
59,536
public static function find ( $ collection , $ id ) { $ id = intval ( $ id ) ; foreach ( $ collection as $ entity ) { if ( $ id === $ entity -> getId ( ) ) { return $ entity ; } } return null ; }
Find By Id
59,537
public function directoryAction ( $ path ) { try { $ this -> setPath ( $ path ) ; } catch ( NotFoundException $ e ) { throw $ e ; } $ dbfile = new WDBFile ( $ this -> getpath ( ) ) ; if ( $ dbfile -> isFile ( ) ) { return $ this -> fileAction ( $ this -> getPath ( ) ) ; } $ readme_content = $ dir_content = '' ; $ index...
Directory path action
59,538
public function fileAction ( $ path ) { try { $ this -> setPath ( $ path ) ; } catch ( NotFoundException $ e ) { throw $ e ; } $ dbfile = new WDBFile ( $ this -> getPath ( ) ) ; if ( $ dbfile -> isDir ( ) ) { return $ this -> directoryAction ( $ this -> getPath ( ) ) ; } $ tpl_params = array ( 'page' => $ dbfile -> get...
File path action
59,539
public function rssFeedAction ( $ path ) { try { $ this -> setPath ( $ path ) ; } catch ( NotFoundException $ e ) { throw $ e ; } $ dbfile = new WDBFile ( $ this -> getpath ( ) ) ; $ contents = array ( ) ; $ tpl_params = array ( 'page' => $ dbfile -> getWDBFullStack ( ) , 'breadcrumbs' => TemplateHelper :: getBreadcrum...
RSS action for concerned path
59,540
public function sitemapAction ( $ path ) { try { $ this -> setPath ( $ path ) ; } catch ( NotFoundException $ e ) { throw $ e ; } $ dbfile = new WDBFile ( $ this -> getpath ( ) ) ; if ( ! $ dbfile -> isDir ( ) ) { throw new NotFoundException ( 'Can not build a sitemap from a single file!' , 0 , null , TemplateHelper ::...
Sitemap action for a path
59,541
public function htmlOnlyAction ( $ path ) { try { $ this -> setPath ( $ path ) ; } catch ( NotFoundException $ e ) { throw $ e ; } $ dbfile = new WDBFile ( $ this -> getpath ( ) ) ; if ( ! $ dbfile -> isFile ( ) ) { throw new NotFoundException ( 'Can not send raw content of a directory!' , 0 , null , TemplateHelper :: ...
HTML only version of a path
59,542
public function plainTextAction ( $ path ) { try { $ this -> setPath ( $ path ) ; } catch ( NotFoundException $ e ) { throw $ e ; } $ dbfile = new WDBFile ( $ this -> getpath ( ) ) ; if ( ! $ dbfile -> isFile ( ) ) { throw new NotFoundException ( 'Can not send raw content of a directory!' , 0 , null , TemplateHelper ::...
Raw plain text action of a path
59,543
public function downloadAction ( $ path ) { try { $ this -> setPath ( $ path ) ; } catch ( NotFoundException $ e ) { throw $ e ; } $ dbfile = new WDBFile ( $ this -> getpath ( ) ) ; if ( ! $ dbfile -> isFile ( ) ) { throw new NotFoundException ( 'Can not send raw content of a directory!' , 0 , null , TemplateHelper :: ...
Download action of a path
59,544
public function searchAction ( $ path ) { try { $ this -> setPath ( $ path ) ; } catch ( NotFoundException $ e ) { throw $ e ; } $ search = $ this -> wdb -> getRequest ( ) -> getArgument ( 's' ) ; if ( empty ( $ search ) ) { return $ this -> indexAction ( $ path ) ; } $ _s = Helper :: makeSearch ( $ search , $ this -> ...
Global search action of a path
59,545
protected function createSeed ( ) { $ templateTags = [ ] ; $ seedsDirectory = $ this -> cmd -> getConfigOpt ( 'seeds_storage' ) ; $ filename = trim ( $ this -> cmd -> question ( 'Seed filename?' ) ) ; $ templateTags [ 'phx:class' ] = Helper :: getQualifiedClassName ( $ filename ) ; $ path = $ seedsDirectory . '/' . $ f...
Create new seed class .
59,546
protected function runSeeds ( ) { foreach ( $ this -> getSeeders ( ) as $ file ) { require_once $ file ; $ className = basename ( $ file , '.php' ) ; $ this -> runSeed ( $ className ) ; } }
Runs all seeders .
59,547
protected function runSeed ( String $ className ) { if ( ! class_exists ( $ className ) ) { throw new SeederNotFoundException ( sprintf ( '[%s] seeder class not found.' , $ className ) ) ; } $ seeder = new $ className ( ) ; return $ seeder -> run ( ) ; }
Runs a single seeder .
59,548
protected function getSeeders ( ) : Array { $ seeders = [ ] ; $ seedsDirectory = $ this -> cmd -> getConfigOpt ( 'seeds_storage' ) ; foreach ( glob ( $ seedsDirectory . '/*' . '.php' ) as $ file ) { $ seeders [ ] = $ file ; } return $ seeders ; }
Returns an array of seeder files .
59,549
public function getLabelAttributes ( ) { $ result = [ ] ; $ label = $ this -> element -> getLabel ( ) ; foreach ( $ label -> getAttributes ( ) as $ attribute => $ value ) { if ( null === $ value ) { $ result [ ] = $ attribute ; continue ; } $ result [ ] = "{$attribute}=\"{$value}\"" ; } return implode ( ' ' , $ result ...
Returns the elements s label attributes as a string
59,550
private function verifyCommand ( ) { $ process = new Process ( 'which cracklib-check' ) ; $ process -> setTimeout ( 10 ) ; $ process -> run ( ) ; if ( $ process -> isSuccessful ( ) ) { return trim ( $ process -> getOutput ( ) ) ; } $ process = new Process ( 'whereis cracklib-check' ) ; $ process -> setTimeout ( 10 ) ; ...
Verify the command to be available
59,551
public function check ( $ password ) { if ( empty ( $ password ) ) { throw new InvalidArgumentException ( 'The password cannot be empty' ) ; } $ process = new Process ( $ this -> command ) ; $ process -> setInput ( $ password ) ; $ process -> mustRun ( ) ; return $ this -> verifyOutput ( $ process -> getOutput ( ) ) ; ...
Performs an obscure check with the given password
59,552
private function verifyOutput ( $ output ) { $ output = trim ( $ output ) ; $ result = 'unknown' ; if ( preg_match ( '/: ([^:]+)$/' , $ output , $ matches ) ) { $ result = $ matches [ 1 ] ; } $ this -> message = $ result ; if ( array_key_exists ( $ result , $ this -> messageStatus ) ) { $ this -> status = $ this -> mes...
Checks the result of the password check
59,553
public function start_lvl ( & $ output , $ depth = 0 , $ args = array ( ) ) { $ indent = ( $ depth > 0 ? str_repeat ( "\t" , $ depth ) : '' ) ; $ display_depth = ( $ depth + 1 ) ; $ classes = array ( 'sub-menu' , ( $ display_depth == 0 ? 'dropdown' : '' ) , ( $ display_depth > 0 ? 'dropdown-menu' : '' ) , ) ; $ class_n...
Starts the list before the elements are added . add classes to ul sub - menus
59,554
public function resolve ( $ themeName = null ) { switch ( true ) { case $ themeName : if ( ! $ theme = $ this -> themeLoader -> retrieveByName ( $ themeName ) ) { throw new InvalidThemeException ( sprintf ( 'No themes registered under for "%s" theme name. Did you mean one of these themes : %s ?' , $ themeName , $ this ...
Select Theme to use from given parameters and return it .
59,555
public function Increment ( ) { if ( $ this -> version == null ) { $ this -> _getVersion ( ) ; } $ this -> version += .1 ; $ this -> _StoreVersion ( ) ; }
Increment version number .
59,556
protected function _getVersion ( ) { if ( empty ( $ this -> version ) ) { $ result = $ this -> cacheHandler -> get ( $ this -> getTagName ( ) ) ; if ( empty ( $ result ) ) { $ this -> ResetTagVersion ( ) ; } else { $ this -> version = $ result ; } } return $ this -> version ; }
return current version number of tag - instance
59,557
function getOwnerId ( ) { if ( $ this -> withIdentity ( ) instanceof iIdentityOfUser ) { $ identity = $ this -> withIdentity ( ) ; $ userId = $ identity -> getOwnerId ( ) ; } else { $ userInfo = $ this -> getAuthInfo ( ) ; $ userId = $ userInfo [ 'user' ] [ 'uid' ] ; } return $ userId ; }
Get Owner Identifier
59,558
function getAuthInfo ( $ grants = false ) { if ( $ this -> _c_info ) return $ this -> _c_info ; $ options = null ; if ( $ grants ) $ options [ 'include_grants' ] = true ; try { $ info = $ this -> federation ( ) -> getMyAccountInfo ( $ options ) ; } catch ( exOAuthAccessDenied $ e ) { throw new exAccessDenied ( $ e -> g...
Retrieve User Info From OAuth Server
59,559
function federation ( ) { if ( $ this -> _c_federation ) return $ this -> _c_federation ; $ federation = clone $ this -> federation ; $ federation -> setTokenProvider ( $ this -> insTokenProvider ( ) ) ; return $ this -> _c_federation = $ federation ; }
Access Federation Commands Of Identified User
59,560
function insTokenProvider ( ) { if ( $ this -> _tokenProvider ) return $ this -> _tokenProvider ; $ identity = $ this -> withIdentity ( ) ; $ tokenProvider = new TokenProviderSolid ( $ identity -> getAccessToken ( ) ) ; return $ tokenProvider ; }
Token Provider Help Call API s Behalf Of User with given token
59,561
public function getCollapseClassNames ( ) { $ classes = $ this -> styles ( 'navbar.collapse' , 'collapse' ) ; if ( $ this -> hasRows ( ) ) { $ classes [ ] = $ this -> style ( 'navbar.column' ) ; } if ( $ align = $ this -> ItemAlign ) { $ classes [ ] = $ this -> style ( sprintf ( 'navbar.item-align-%s' , $ align ) ) ; }...
Answers an array of collapse class names for the HTML template .
59,562
public function getLogoDimensions ( ) { $ data = [ ] ; $ widths = $ this -> dbObject ( 'BrandLogoWidth' ) ; $ heights = $ this -> dbObject ( 'BrandLogoHeight' ) ; foreach ( $ widths -> getViewports ( ) as $ viewport ) { if ( $ value = $ widths -> getField ( $ viewport ) ) { $ data [ $ viewport ] [ 'Width' ] = $ value ;...
Answers a list of logo dimensions for the custom CSS template .
59,563
public function getBackgroundOptions ( ) { return [ self :: BG_PRIMARY => _t ( __CLASS__ . '.PRIMARY' , 'Primary' ) , self :: BG_LIGHT => _t ( __CLASS__ . '.LIGHT' , 'Light' ) , self :: BG_DARK => _t ( __CLASS__ . '.DARK' , 'Dark' ) ] ; }
Answers an array of options for the background field .
59,564
public function getItemAlignOptions ( ) { return [ self :: ITEM_ALIGN_START => _t ( __CLASS__ . '.START' , 'Start' ) , self :: ITEM_ALIGN_CENTER => _t ( __CLASS__ . '.CENTER' , 'Center' ) , self :: ITEM_ALIGN_END => _t ( __CLASS__ . '.END' , 'End' ) , self :: ITEM_ALIGN_BETWEEN => _t ( __CLASS__ . '.BETWEEN' , 'Between...
Answers an array of options for the item align field .
59,565
public function getItemJustifyOptions ( ) { return [ self :: ITEM_ALIGN_START => _t ( __CLASS__ . '.START' , 'Start' ) , self :: ITEM_ALIGN_CENTER => _t ( __CLASS__ . '.CENTER' , 'Center' ) , self :: ITEM_ALIGN_END => _t ( __CLASS__ . '.END' , 'End' ) , self :: ITEM_ALIGN_BASELINE => _t ( __CLASS__ . '.BASELINE' , 'Bas...
Answers an array of options for the item justify field .
59,566
protected function createCtrl ( ) { $ oView = ViewFactory :: createView ( $ this -> ctrlName , str_replace ( 'action' , '' , $ this -> actionName ) ) ; $ aComponentsRootMap = AppHelper :: getInstance ( ) -> getConfig ( 'componentsRootMap' ) ; if ( ! isset ( $ aComponentsRootMap [ 'controllers' ] ) ) { throw new Excepti...
It creates the controller object assignes it with default view and layout objects .
59,567
public function resolveSql ( array $ parameters = array ( ) ) { $ sql = preg_replace_callback ( '|/\*\*(.+?)\*\*/|' , function ( $ match ) use ( & $ parameters ) { $ name = trim ( $ match [ 1 ] ) ; $ snippet = $ this -> builder -> resolveSnippet ( $ name , $ parameters ) ; return $ snippet ; } , $ this -> sql ) ; $ typ...
Resolve SQL statement .
59,568
public function create ( Description $ description ) { return new ContactEntity ( $ description -> getOptionalProperty ( 'phone' ) , $ description -> getOptionalProperty ( 'twitter' ) , $ description -> getOptionalProperty ( 'facebook' ) ) ; }
Create contact information from a description .
59,569
public function addWorker ( $ worker ) { if ( ! $ worker instanceof Worker ) { throw new \ Exception ( '$worker is not an instance of Worker' ) ; } $ this -> workerList [ $ worker -> getId ( ) ] = $ worker ; return $ this ; }
Adds a worker to the action .
59,570
public function removeWorker ( $ id ) { if ( $ id instanceof Worker ) { $ id = $ id -> getId ( ) ; } if ( isset ( $ this -> waitingList [ $ id ] ) ) { unset ( $ this -> waitingList [ $ id ] ) ; } if ( isset ( $ this -> workerList [ $ id ] ) ) { unset ( $ this -> workerList [ $ id ] ) ; } return $ this ; }
Removes the worker from the action .
59,571
public function addWaitingWorker ( $ id ) { if ( $ id instanceof Worker ) { $ id = $ id -> getId ( ) ; } if ( ! isset ( $ this -> workerList [ $ id ] ) ) { throw new \ Exception ( 'Trying to add non existent worker to the queue.' ) ; } $ worker = $ this -> workerList [ $ id ] ; $ this -> ready = true ; if ( ! isset ( $...
Adds the worker to the waiting list if it is not already in there .
59,572
public function fetchWaitingWorker ( ) { $ count = count ( $ this -> waitingList ) ; for ( $ i = 0 ; $ i < $ count ; $ i ++ ) { $ worker = array_shift ( $ this -> waitingList ) ; if ( $ worker -> isValid ( ) && $ worker -> isReady ( ) ) { return $ worker ; } } $ this -> ready = false ; return null ; }
Gets the first available worker in the waiting list .
59,573
public function cleanup ( ) { foreach ( $ this -> workerList as $ worker ) { if ( ! $ worker -> isValid ( ) ) { $ this -> removeWorker ( $ worker ) ; } } return $ this ; }
Removes all invalid workers .
59,574
protected function confirmAnUserIsCreatedInAcachaLaravelForge ( ) { $ this -> info ( '' ) ; $ this -> info ( 'Please visit and login on http://forge.acacha.org' ) ; $ this -> info ( '' ) ; $ this -> error ( 'Please use Github Social Login for login!!!' ) ; while ( ! $ this -> confirm ( 'Do you have an user created at h...
Confirm an user is created in Acacha Laravel Forge .
59,575
function getLayout ( ) { $ layoutName = ( $ this -> layout ) ? $ this -> layout : $ this -> getDefaultLayoutName ( ) ; if ( strstr ( $ layoutName , '/' ) === false ) { $ DS = ( defined ( 'DS' ) ) ? constant ( 'DS' ) : DIRECTORY_SEPARATOR ; $ pathname = self :: $ PATH_PREFIX . $ DS . $ this -> deriveLayoutPathPrefix ( )...
Get view script layout
59,576
final function deriveLayoutPathPrefix ( ) { $ moduleNamespace = $ this -> deriveModuleNamespace ( ) ; $ path = ( $ moduleNamespace ) ? $ moduleNamespace . '/' : '' ; $ path .= $ this -> deriveWidgetName ( ) ; $ path = str_replace ( '\\' , '/' , $ this -> inflectName ( $ path ) ) ; return $ path ; }
Get layout path prefixed to module layout name
59,577
private function getConnection ( ) { if ( ! isset ( $ this -> connection ) ) { $ config = new Configuration ( ) ; $ this -> connection = DriverManager :: getConnection ( $ this -> connectionParams , $ config ) ; } return $ this -> connection ; }
Returns the connection object .
59,578
public function setTimezone ( $ timezone ) { $ smt = $ this -> getConnection ( ) -> prepare ( 'SET time_zone = ?' ) ; $ smt -> bindValue ( 1 , $ timezone ) ; $ smt -> execute ( ) ; }
Sets a timezone .
59,579
public function encrypt ( $ data ) { if ( ! $ data || ! is_scalar ( $ data ) ) { return null ; } $ nonce = random_bytes ( SODIUM_CRYPTO_SECRETBOX_NONCEBYTES ) ; $ cipher = sodium_crypto_secretbox ( $ data , $ nonce , $ this -> key ) ; return base64_encode ( $ nonce . $ cipher ) ; }
Encrypt a string .
59,580
protected function checkSite ( ) { $ sites = $ this -> fetchSites ( fp_env ( 'ACACHA_FORGE_SERVER' ) ) ; return in_array ( fp_env ( 'ACACHA_FORGE_SITE' ) , collect ( $ sites ) -> pluck ( 'id' ) -> toArray ( ) ) ; }
Check site .
59,581
protected function checkSiteAndAbort ( $ site = null ) { $ site = $ site ? $ site : fp_env ( 'ACACHA_FORGE_SITE' ) ; if ( ! $ this -> checkSite ( $ site ) ) { $ this -> error ( 'Site ' . $ site . ' not valid' ) ; die ( ) ; } }
Check site and abort .
59,582
public function resolveErrorHandler ( $ errorCode ) { return array_key_exists ( $ errorCode , $ this -> errorHandlers ) ? call_user_func_array ( $ this -> errorHandlers [ $ errorCode ] , [ ] ) : '' ; }
Resolve an error handler
59,583
public function onCreateZone ( ZoneEvent $ event ) { $ zone = $ event -> getZone ( ) ; if ( $ zone -> getComponents ( ) -> isEmpty ( ) ) { return ; } $ this -> save ( $ zone ) ; }
Zone creation event handler . Triggers persistence call only if component was defined into it .
59,584
public function setItem ( $ item , $ index = null ) : ContainerInterface { if ( is_null ( $ index ) ) { $ this -> items [ ] = $ item ; } else { $ this -> items [ $ index ] = $ item ; } return $ this ; }
Set an item into children list .
59,585
public function removeItemByIndex ( $ index ) : ContainerInterface { if ( $ this -> hasItem ( $ index ) ) { $ this -> items [ $ index ] = null ; unset ( $ this -> items [ $ index ] ) ; } return $ this ; }
Removes the child from the children list for the given index .
59,586
protected function getItemsCode ( ) : string { $ code = '' ; if ( $ this -> countItems ( ) > 0 ) { foreach ( $ this -> getAllItems ( ) as $ item ) { if ( is_string ( $ item ) ) { $ code .= $ item ; } else { $ code .= ( string ) $ item ; } } } return $ code ; }
Get html code for children .
59,587
function helper ( $ helper_name ) { if ( array_key_exists ( $ helper_name , $ this -> helpers ) ) { return $ this -> helpers [ $ helper_name ] ; } else { $ classname = 'Helper_' . ucwords ( $ helper_name ) ; return new $ classname ( $ this -> modules , $ this -> server , $ this -> request , $ this -> security ) ; } }
Instanciates a helper .
59,588
function view ( $ view_name , array $ var_list = NULL , array $ block_list = NULL ) { if ( $ var_list === NULL ) { $ var_list = array ( ) ; } $ vars = ( object ) $ var_list ; $ blocks = ( object ) $ block_list ; if ( $ hook_data = $ this -> modules -> preView ( $ this -> request , $ view_name , $ vars ) ) { return $ ho...
Loads a view .
59,589
protected function model ( $ model_name ) { if ( stripos ( $ model_name , 'model' ) === false ) { $ model_name = sprintf ( '%s\models\%s' , $ this -> server -> getAppName ( ) , $ model_name ) ; } if ( $ hook_data = $ this -> modules -> preModel ( $ model_name ) ) { return $ hook_data ; } if ( ! class_exists ( $ model_n...
Loads a model .
59,590
protected function dump ( $ var , $ no_html = false ) { $ dump = var_export ( $ var , true ) ; if ( $ no_html ) { return $ dump ; } else { return '<pre>' . htmlentities ( $ dump ) . '</pre>' . PHP_EOL ; ; } }
Tiny wrapper arround var_dump to ease debugging .
59,591
protected final function checkCsrf ( ) { $ valid = false ; $ r = $ this -> request ; if ( $ r -> getSession ( 'assegai_csrf_token' ) && $ r -> post ( 'csrf' ) && $ r -> getSession ( 'assegai_csrf_token' ) == $ r -> post ( 'csrf' ) ) { $ valid = true ; } $ this -> request -> killSession ( 'assegai_csrf_token' ) ; return...
Checks the validity of the CSRF token .
59,592
public function trigger ( $ eventName , $ origin = null , $ context = [ ] , EventInterface $ event = null ) { if ( $ eventsHandler = $ this -> getEventsHandler ( ) ) { $ eventsHandler -> trigger ( $ eventName , $ origin , $ context , $ event ) ; } }
Proxy trigger method
59,593
public function bind ( $ eventName , $ callback , $ mode = EventsHandlerInterface :: BINDING_MODE_LAST ) { if ( $ eventsHandler = $ this -> getEventsHandler ( ) ) { $ eventsHandler -> bind ( $ eventName , $ callback , $ mode ) ; } }
Proxy bind method
59,594
public function processExchangePlatformOrder ( Varien_Event_Observer $ observer ) { $ order = $ observer -> getEvent ( ) -> getOrder ( ) ; $ quote = $ order -> getQuote ( ) ; Mage :: dispatchEvent ( 'ebayenterprise_giftcard_redeem' , array ( 'quote' => $ quote , 'order' => $ order ) ) ; return $ this ; }
Perform all processing necessary for the order to be placed with the Exchange Platform - allocate inventory redeem SVC . If any of the observers need to indicate that an order should not be created the observer method should throw an exception . Observers the sales_order_place_before event .
59,595
public function rollbackExchangePlatformOrder ( Varien_Event_Observer $ observer ) { Mage :: helper ( 'ebayenterprise_magelog' ) -> debug ( __METHOD__ ) ; Mage :: dispatchEvent ( 'eb2c_order_creation_failure' , array ( 'quote' => $ observer -> getEvent ( ) -> getQuote ( ) , 'order' => $ observer -> getEvent ( ) -> getO...
Roll back any Exchange Platform actions made for the order - rollback allocation void SVC redemptions void payment auths . Observes the sales_model_service_quote_submit_failure event .
59,596
public function handleShipGroupChargeType ( Varien_Event_Observer $ observer ) { $ event = $ observer -> getEvent ( ) ; $ shipGroup = $ event -> getShipGroupPayload ( ) ; Mage :: helper ( 'radial_core/shipping_chargetype' ) -> setShippingChargeType ( $ shipGroup ) ; return $ this ; }
respond to the order create s request for a valid ship group charge type
59,597
public function handleSalesQuoteCollectTotalsAfter ( Varien_Event_Observer $ observer ) { $ event = $ observer -> getEvent ( ) ; $ quote = $ event -> getQuote ( ) ; $ addresses = $ quote -> getAddressesCollection ( ) ; foreach ( $ addresses as $ address ) { $ appliedRuleIds = $ address -> getAppliedRuleIds ( ) ; if ( i...
Account for shipping discounts not attached to an item . Combine all shipping discounts into one .
59,598
public function handleSalesRuleValidatorProcess ( Varien_Event_Observer $ observer ) { $ event = $ observer -> getEvent ( ) ; $ rule = $ event -> getRule ( ) ; $ quote = $ event -> getQuote ( ) ; $ store = $ quote -> getStore ( ) ; $ item = $ event -> getItem ( ) ; $ result = $ event -> getResult ( ) ; $ data = ( array...
Account for discounts in order create request .
59,599
protected function calculateDiscountAmount ( Mage_Sales_Model_Quote_Item_Abstract $ item , Varien_Object $ result , array $ data ) { $ itemRowTotal = $ item -> getBaseRowTotal ( ) ; $ currentDiscountAmount = $ result -> getBaseDiscountAmount ( ) ; $ previousAppliedDiscountAmount = 0.00 ; foreach ( $ data as $ discount ...
When the previously applied discount amount on the item row total is less than the current applied discount recalculate the current discount to account for previously applied discount . Otherwise don t recalculate the current discount .