idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
57,500 | protected function modifyMonths ( $ amount , $ invert = false ) { $ interval = new \ DateInterval ( "P{$amount}M" ) ; $ this -> modifyFromInterval ( $ interval , $ invert ) ; return $ this ; } | Modify by an amount of months . |
57,501 | protected function modifyYears ( $ amount , $ invert = false ) { $ interval = new \ DateInterval ( "P{$amount}Y" ) ; $ this -> modifyFromInterval ( $ interval , $ invert ) ; return $ this ; } | Modify by an amount of Years . |
57,502 | protected function modifyMinutes ( $ amount , $ invert = false ) { $ interval = new \ DateInterval ( "PT{$amount}M" ) ; $ this -> modifyFromInterval ( $ interval , $ invert ) ; return $ this ; } | Modify by an amount of minutes . |
57,503 | protected function modifyWeeks ( $ amount , $ invert = false ) { $ interval = new \ DateInterval ( "P{$amount}W" ) ; $ this -> modifyFromInterval ( $ interval , $ invert ) ; return $ this ; } | Modify by an amount of weeks . |
57,504 | public function getDifferenceInMonths ( $ compare = null ) { if ( ! $ compare ) { $ compare = new Date ( null , $ this -> getTimezone ( ) ) ; } $ difference = $ this -> diff ( $ compare ) ; list ( $ years , $ months ) = explode ( ':' , $ difference -> format ( '%y:%m' ) , 2 ) ; return ( ( $ years * 12 ) + $ months ) * ... | Get the difference in months . |
57,505 | public function setSubject ( $ subject ) { $ translator = $ this -> getTranslator ( ) ; $ this -> subject = $ translator ? $ translator -> trans ( $ subject ) : $ subject ; } | Set the subject of the mail |
57,506 | public function handle ( $ data ) { $ this -> data = $ data ; if ( $ message = $ this -> createMessage ( ) ) { $ this -> getMailer ( ) -> send ( $ message ) ; } } | Execute the handling |
57,507 | public function getPath ( ) : string { if ( \ count ( $ this -> segments ) === 0 ) { return '/' ; } $ path = sprintf ( '/%s/' , implode ( '/' , $ this -> segments ) ) ; if ( ! $ this -> definition -> hasSlash ( ) ) { $ path = substr ( $ path , 0 , - 1 ) ; } return $ path ; } | Returns the unencoded canonical path for the requested route . |
57,508 | public function getParameter ( string $ name ) : string { if ( ! isset ( $ this -> values [ $ name ] ) ) { throw new \ InvalidArgumentException ( "Invalid route parameter '$name'" ) ; } return $ this -> values [ $ name ] ; } | Returns the value for the given parameter from the requested route . |
57,509 | public function fromUrl ( string $ requestUrl ) { parse_str ( parse_url ( $ requestUrl ) [ "query" ] ?? "" , $ query ) ; return $ this -> fromQuery ( $ query ) ; } | Parse web request and create lead with common information |
57,510 | private function cleanSignals ( array $ values ) { $ cleanedValues = array ( ) ; foreach ( $ values as $ value ) { if ( is_string ( $ value ) ) { $ value = @ constant ( $ value ) ; if ( null === $ value ) { throw new \ InvalidArgumentException ( sprintf ( 'The value "%s" does not specify name of a PCNTL signal constant... | Cleans a signal value . |
57,511 | protected function fetchMySQLDatabases ( ) { $ uri = str_replace ( '{forgeserver}' , $ this -> server , config ( 'forge-publish.get_mysql_uri' ) ) ; $ this -> url = config ( 'forge-publish.url' ) . $ uri ; try { $ response = $ this -> http -> get ( $ this -> url , [ 'headers' => [ 'X-Requested-With' => 'XMLHttpRequest'... | Fetch MySQLDatabases . |
57,512 | protected function getMySQLDatabaseByName ( $ databases , $ database_name ) { $ database_found = collect ( $ databases ) -> filter ( function ( $ database ) use ( $ database_name ) { return $ database [ 'name' ] === $ database_name ; } ) -> first ( ) ; if ( $ database_found ) { return $ database_found ; } return null ;... | Get mysql database from databases by name . |
57,513 | public function fails ( ) { $ ban = false ; if ( count ( @ $ this -> fails [ "failed" ] ) > 0 || count ( @ $ this -> fails [ "messages" ] ) > 0 ) { $ ban = true ; } return $ ban ; } | indica si tiene errores |
57,514 | public function first ( $ field , $ format = '' ) { if ( $ format ) { @ $ this -> fails [ "messages" ] [ $ field ] [ 0 ] = str_replace ( ':message' , @ $ this -> fails [ "messages" ] [ $ field ] [ 0 ] , $ format ) ; } return @ $ this -> fails [ "messages" ] [ $ field ] [ 0 ] ? @ $ this -> fails [ "messages" ] [ $ field... | retorna el primer mensage del campo indicado |
57,515 | public function get ( $ field , $ format = '' ) { if ( $ format ) { if ( is_array ( @ $ this -> fails [ "messages" ] ) ) { foreach ( $ this -> fails [ "messages" ] as $ field => $ value ) { $ this -> fails [ "messages" ] [ $ field ] = array_map ( function ( $ v ) use ( $ format ) { return str_replace ( ':message' , $ v... | retorna todos mensages del campo indicado |
57,516 | public function set ( $ field , $ msg ) { @ $ this -> fails [ 'messages' ] [ $ field ] [ ] = str_replace ( ":attribute" , $ field , $ msg ) ; @ $ this -> fails [ "failed" ] [ $ field ] [ ] = true ; } | aplica un mensaje de error |
57,517 | public function render ( $ view , array $ params = array ( ) ) { $ this -> setView ( $ view ) ; $ this -> setParams ( array_merge ( $ this -> getDefaultViewParams ( ) , $ params ) ) ; $ this -> setOutput ( $ this -> twig -> render ( $ this -> getView ( ) , $ this -> getParams ( ) ) ) ; return $ this -> getOutput ( ) ; ... | Building of a view content by Twig |
57,518 | public function getDefaultViewParams ( ) { $ wdb = FrontController :: getInstance ( ) ; $ session = $ wdb -> getUser ( ) -> getSession ( ) ; return array ( 'WDB' => $ wdb , 'user_cfg' => Kernel :: get ( 'user_config' ) , 'manifest' => Kernel :: get ( 'manifest' ) , 'app_cfg' => Kernel :: getConfig ( 'html' , array ( ) ... | Get an array of the default parameters for all views |
57,519 | protected function findParentButtons ( BlockInterface $ block ) { if ( $ block -> getAttribute ( 'block_parent_buttons' ) ) { return $ block -> getAttribute ( 'block_parent_buttons' ) ; } $ parent = $ block ; if ( $ block -> getOption ( 'scrollable' ) ) { foreach ( $ block -> all ( ) as $ child ) { if ( BlockUtil :: is... | Finds the parent block of buttons . |
57,520 | public function dropdown ( $ title , $ url , \ Closure $ callback , $ order = 0 , array $ attributes = array ( ) ) { $ properties = compact ( 'title' , 'url' , 'order' , 'attributes' ) ; if ( func_num_args ( ) == 4 ) { $ arguments = func_get_args ( ) ; $ title = array_get ( $ arguments , 0 ) ; $ attributes = array_get ... | Register new child menu with dropdown . |
57,521 | static public function createTempDir ( $ rootName = 'root' ) { self :: $ root = vfsStream :: setup ( $ rootName ) ; return vfsStream :: url ( $ rootName ) . DIRECTORY_SEPARATOR ; } | Return path to create a temporary directory . Every new call deletes content of previous one . |
57,522 | public function setParam ( $ key , $ value ) { $ key = ( null !== ( $ alias = $ this -> getAlias ( $ key ) ) ) ? $ alias : $ key ; parent :: setParam ( $ key , $ value ) ; return $ this ; } | Set a userland parameter |
57,523 | public function getClientIp ( $ checkProxy = true ) { if ( $ checkProxy && $ this -> getServer ( 'HTTP_CLIENT_IP' ) != null ) { $ ip = $ this -> getServer ( 'HTTP_CLIENT_IP' ) ; } else if ( $ checkProxy && $ this -> getServer ( 'HTTP_X_FORWARDED_FOR' ) != null ) { $ ip = $ this -> getServer ( 'HTTP_X_FORWARDED_FOR' ) ;... | Get the client s IP addres |
57,524 | public function buildGravatarUrl ( ) { $ base_url = self :: HTTPS_GRAVATAR_URL ; if ( ! $ this -> secure ) { $ base_url = self :: HTTP_GRAVATAR_URL ; } return $ base_url . 'avatar/' . $ this -> generateAddressHash ( ) . '?s=' . $ this -> size . '&r=' . $ this -> rating . '&d=' . $ this -> default_avatar ; } | Builds and returns the final Gravatar URL . |
57,525 | protected function _addDependency ( $ testable , $ class ) { if ( $ testable -> findNextContent ( array ( "use {$class};" ) ) ) { return ; } $ tokens = $ testable -> tokens ( ) ; $ lines = $ testable -> lines ( ) ; if ( $ token = $ testable -> findNext ( array ( T_USE ) ) ) { array_splice ( $ lines , $ tokens [ $ token... | Place use statements below other use statements or if not present 1 line after the namespace declaration . |
57,526 | public function scan ( $ directory , array $ options = array ( ) ) { set_time_limit ( 0 ) ; $ options += array ( 'sort' => null , 'order' => null , 'filter_key' => null , 'filter_value' => null ) ; $ result = null ; $ this -> hook -> attach ( 'module.file_manager.scan.before' , $ directory , $ options , $ result , $ th... | Returns an array of scanned files or counts them |
57,527 | protected function sort ( array & $ files , $ sort , $ order ) { $ sorters = $ this -> getSorters ( ) ; if ( isset ( $ sorters [ $ sort ] [ 'handlers' ] [ 'sort' ] ) ) { $ function = $ sorters [ $ sort ] [ 'handlers' ] [ 'sort' ] ; @ uasort ( $ files , function ( $ a , $ b ) use ( $ function , $ order ) { return $ func... | Sorts an array of files |
57,528 | public function getFilters ( ) { $ filters = & gplcart_static ( 'module.file_manager.filter.list' ) ; if ( isset ( $ filters ) ) { return $ filters ; } $ filters = ( array ) gplcart_config_get ( __DIR__ . '/../config/filters.php' ) ; $ this -> hook -> attach ( 'module.file_manager.filter.list' , $ filters , $ this ) ; ... | Returns an array of supported filters |
57,529 | public function getSorters ( ) { $ sorters = & gplcart_static ( 'module.file_manager.sorter.list' ) ; if ( isset ( $ sorters ) ) { return $ sorters ; } $ sorters = ( array ) gplcart_config_get ( __DIR__ . '/../config/sorters.php' ) ; $ this -> hook -> attach ( 'module.file_manager.sorter.list' , $ sorters , $ this ) ; ... | Returns an array of file sorters |
57,530 | public function getInitialPath ( $ absolute = false ) { $ path = $ this -> module -> getSettings ( 'file_manager' , 'initial_path' ) ; return $ absolute ? gplcart_file_absolute ( $ path ) : $ path ; } | Returns a string with initial path to scan files |
57,531 | protected function setupFormatters ( OutputFormatterInterface $ formatter ) { $ formatter -> setStyle ( 'file' , new OutputFormatterStyle ( 'white' , 'default' , [ 'bold' ] ) ) ; $ formatter -> setStyle ( 'source' , new OutputFormatterStyle ( 'blue' , 'default' , [ ] ) ) ; $ formatter -> setStyle ( 'success' , new Outp... | Setup the formatter . |
57,532 | protected function renderSummary ( array $ withErrors , array $ withWarnings , OutputInterface $ output ) { $ output -> writeln ( "\n" ) ; if ( count ( $ withErrors ) ) { $ output -> writeln ( '<error>Errors:</error>' ) ; $ this -> renderErrors ( $ withErrors , $ output ) ; } if ( count ( $ withWarnings ) ) { $ output ... | Render the error and warning summary . |
57,533 | protected function renderErrors ( array $ files , OutputInterface $ output ) { foreach ( $ files as $ file ) { $ output -> writeln ( '<file>' . $ file -> getFilename ( ) . '</file>' ) ; $ this -> renderMessages ( $ file -> getErrors ( ) , $ output ) ; $ output -> writeln ( '' ) ; } } | Render errors into the console . |
57,534 | protected function renderWarnings ( array $ files , OutputInterface $ output ) { foreach ( $ files as $ file ) { $ output -> writeln ( '<file>' . $ file -> getFilename ( ) . '</file>' ) ; $ this -> renderMessages ( $ file -> getWarnings ( ) , $ output ) ; $ output -> writeln ( '' ) ; } } | Render warnings into the console . |
57,535 | protected function renderMessages ( array $ messages , OutputInterface $ output ) { foreach ( $ messages as $ line => $ lineErrors ) { foreach ( $ lineErrors as $ column => $ columnErrors ) { foreach ( $ columnErrors as $ error ) { $ output -> writeln ( [ ">> $line:$column <source>" . $ error [ 'source' ] . '</source... | Render individual error and warning messages . |
57,536 | public function map_string ( $ pcre = null ) { $ list = array_map ( 'strval' , $ this -> getArrayCopy ( ) ) ; $ dlist = array ( ) ; if ( $ pcre ) { foreach ( $ list as $ item ) { $ dlist [ ] = preg_match ( $ pcre , $ item ) ? $ item : null ; } $ list = array_values ( array_filter ( $ dlist ) ) ; } return $ list ; } | Maps each element in the CFArray object as a string . |
57,537 | public function store ( Request $ request ) { $ this -> authorize ( 'create' , Ticket :: class ) ; $ this -> validate ( $ request , [ 'email' => 'required|exists:users,email|not_in:' . Auth :: user ( ) -> email , 'subject' => 'required|max:255' , 'message' => 'required|max:2500' , ] ) ; $ user = User :: where ( 'email'... | Validate form and user and save ticket and the first message . |
57,538 | public function sendto ( UdpMessageEvent $ event , $ message , $ flag = 0 , $ raw = false ) { if ( ( $ event -> sender instanceof Connection ) && $ event -> sender -> listener -> parser ) { $ message = call_user_func ( [ $ event -> sender -> listener -> parser , 'encode' ] , $ message , null ) ; } stream_socket_sendto ... | send message to udp client |
57,539 | public function getMigrationScripts ( int $ from , int $ to , array $ skipScripts = [ ] ) : array { $ migrationScripts = [ ] ; $ provider = MigrationsStateProvider :: getProvider ( ) ; foreach ( $ this -> migrationScripts as $ scriptClass ) { $ migrationScript = new $ scriptClass ( ) ; if ( ! is_a ( $ migrationScript ,... | Returns an ordered array of MigrationScriptInterface objects within the range specified . |
57,540 | public static function registerMigrationManager ( string $ migrationManagerClass ) { Application :: current ( ) -> container ( ) -> registerSingleton ( MigrationsManager :: class , function ( ) use ( $ migrationManagerClass ) { return $ migrationManagerClass :: singleton ( ) ; } ) ; } | Used to override the generic migration manager with a custom one . |
57,541 | public function flash ( string $ name , $ value ) : void { if ( $ this -> has ( $ name ) ) { $ this -> remove ( $ name ) ; } else { $ this -> set ( $ name , $ value ) ; } } | Store items in the session only for the next request . |
57,542 | public static function getCommandRunningCount ( $ name ) { exec ( sprintf ( "ps auxwww|grep '%s'|grep -v grep" , $ name ) , $ output ) ; if ( false === is_array ( $ output ) ) { return 1 ; } foreach ( $ output as $ lineIndex => $ line ) { if ( false !== strpos ( $ line , '/bin/sh -c' ) ) { unset ( $ output [ $ lineInde... | Get Command Running count . |
57,543 | public static function getEntityChoice ( SymfonyStyle $ helper , $ entities , $ question = 'Please choose' ) { $ choice = [ ] ; foreach ( $ entities as $ entity ) { $ choice [ $ entity -> getId ( ) ] = strval ( $ entity ) ; } if ( 0 === count ( $ choice ) ) { throw new \ RuntimeException ( 'No choices found!' ) ; } $ s... | Get Entity Choice |
57,544 | public static function writeFinishedMessage ( SymfonyStyle $ helper , $ commandName ) { $ helper -> newLine ( 2 ) ; $ helper -> note ( [ sprintf ( 'Executed %s' , $ commandName ) , sprintf ( 'Done within %s seconds' , round ( ( microtime ( true ) - $ _SERVER [ "REQUEST_TIME_FLOAT" ] ) , 4 ) ) , date ( 'Y-m-d H:i:s' ) ,... | Write Finished Message |
57,545 | public static function writeAssociativeArrayTable ( SymfonyStyle $ helper , $ array , $ flatten = null ) { if ( null !== $ flatten ) { $ helper -> note ( 'Using flatten is deprecated' ) ; } if ( false === is_array ( $ array ) ) { $ helper -> error ( [ 'Expecting associative array for table' , sprintf ( 'Given data for ... | Write associative array as table |
57,546 | public static function getStringForTable ( $ value ) { if ( true === is_string ( $ value ) ) { return wordwrap ( $ value , self :: MAX_STRING_LENGTH , PHP_EOL ) ; } if ( true === is_bool ( $ value ) ) { if ( true === $ value ) { return 'TRUE' ; } return 'FALSE' ; } if ( $ value instanceof \ DateTime ) { return $ value ... | Get String for Table |
57,547 | public function handle_error ( $ level , $ message , $ file = null , $ line = null ) { if ( $ level & error_reporting ( ) ) { if ( $ this -> is_silenced ( $ file ) ) { return true ; } $ this -> handle_exception ( new \ ErrorException ( $ message , 0 , $ level , $ file , $ line ) ) ; return true ; } return false ; } | Handle an error |
57,548 | private function is_silenced ( $ path ) { foreach ( $ this -> silenced_paths as $ silenced_path ) { if ( preg_match ( $ silenced_path , $ path ) ) { return true ; } } return false ; } | Check if a given path has been silenced |
57,549 | public function render ( $ view , array $ data = [ ] ) { return $ this -> blade -> share ( 'errors' , $ this -> session -> pull ( 'errors' ) ) -> render ( $ view , $ data ) ; } | To render view |
57,550 | public function domainNotAllowed ( Array $ configuration ) { $ connectionName = '' ; $ config = array_values ( $ configuration ) [ 0 ] ; if ( key ( $ configuration ) ) { $ connectionName = key ( $ configuration ) ; } if ( is_array ( $ config [ 'domain' ] ) ) { if ( sizeof ( $ config [ 'domain' ] ) > 1 ) { $ errorReport... | This method throws an exception if an attempt is made to connect to the on the domain that is not specified in the configuration file . |
57,551 | public function delSessions ( $ session_keys ) { if ( $ this -> isSingle ( ) ) { foreach ( $ session_keys as $ session_key ) { $ this -> delSession ( $ session_key ) ; } } } | Delete Multi Sessions |
57,552 | public function getMetadatum ( $ name ) { if ( array_key_exists ( $ name , $ this -> metadata ) ) { return $ this -> metadata [ $ name ] ; } return null ; } | Retrieve a single metadatum |
57,553 | protected function validateStringCallbackFor54 ( $ callback ) { if ( ! strstr ( $ callback , '::' ) ) { return true ; } list ( $ class , $ method ) = explode ( '::' , $ callback , 2 ) ; if ( ! class_exists ( $ class ) ) { throw new Exception ( sprintf ( 'Static method call "%s" refers to a class that does not exist' , ... | Validate a static method call |
57,554 | public function assertIsEqual ( $ value1 , $ value2 , $ message = '%s and %s must be equal' , $ exception = 'Asserts' ) { if ( $ value1 !== $ value2 ) { $ this -> throwException ( $ exception , $ message , array ( $ value1 , $ value2 ) ) ; } } | Verifies that the specified conditions are equal . The assertion fails if the conditions are not equal . |
57,555 | public function publicUpdateProfile ( Request $ request ) { $ notValid = $ this -> mainUpdateProfile ( $ request ) ; if ( $ notValid ) { return redirect ( ) -> route ( 'laralum_public::profile.edit' ) -> with ( 'error' , $ notValid ) ; } return redirect ( ) -> route ( 'laralum_public::profile.index' ) -> with ( 'succes... | Update profile from public form and return the public profile view . |
57,556 | private function mainUpdateProfile ( $ request ) { $ this -> validate ( $ request , [ 'name' => 'required|min:3|max:191' , 'current_password' => 'required' , ] ) ; $ user = User :: findOrFail ( Auth :: id ( ) ) ; if ( ! Hash :: check ( $ request -> current_password , $ user -> password ) ) { return __ ( 'laralum_profil... | Validate public and private forms indifferently and update info if validations are OK . |
57,557 | public function getRateLimit ( ) { if ( ! $ this -> lastResponse ) { return null ; } $ limit = $ this -> lastResponse -> getHeader ( 'X-Rate-Limit-Limit' ) ; return $ limit ? $ limit -> normalize ( ) : null ; } | The amount of names in the current time window |
57,558 | public function getRateRemainingLimit ( ) { if ( ! $ this -> lastResponse ) { return null ; } $ limit = $ this -> lastResponse -> getHeader ( 'X-Rate-Limit-Remaining' ) ; return $ limit ? $ limit -> normalize ( ) : null ; } | The number of names left in the current time window |
57,559 | public function getRateReset ( ) { if ( ! $ this -> lastResponse ) { return null ; } $ limit = $ this -> lastResponse -> getHeader ( 'X-Rate-Reset' ) ; return $ limit ? $ limit -> normalize ( ) : null ; } | Seconds remaining until a new time window opens |
57,560 | static public function create ( $ templateName , App $ app , $ templateType = null ) { if ( $ templateType === null ) { $ tmp = explode ( '.' , $ templateName ) ; $ templateType = $ tmp [ count ( $ tmp ) - 1 ] ; } else { $ templateType = strtolower ( $ templateType ) ; } return self :: loadTemplate ( $ templateName , $... | Gets an ALayout object |
57,561 | public function loadLayout ( MvcEvent $ e ) { $ result = $ e -> getViewModel ( ) ; if ( ! $ result -> terminate ( ) ) { $ this -> layout -> load ( ) ; } } | load layout if result ist not terminated |
57,562 | protected function makeFinder ( ) { $ directories = RootDirectories :: getEnforceable ( ) ; $ found = [ ] ; $ filesystem = new Filesystem ( ) ; foreach ( $ directories as $ directory ) { if ( $ filesystem -> exists ( $ directory ) && is_dir ( $ directory ) ) { $ found [ ] = $ directory ; } } return DefaultFinder :: cre... | Make the default finder for SellerLabs projects . |
57,563 | public function actionIndex ( ) { $ searchModel = new MediaSearch ( ) ; $ dataProvider = $ searchModel -> search ( request ( ) -> queryParams ) ; $ dataProvider -> pagination -> pageSize = request ( ) -> get ( 'per-page' , 20 ) ; $ dataProvider -> sort -> defaultOrder = [ 'id' => SORT_DESC ] ; return $ this -> render (... | Lists all Media models . |
57,564 | protected function findModel ( $ id ) { if ( ( $ model = Media :: findOne ( $ id ) ) !== null ) { return $ model ; } else { throw new NotFoundHttpException ( t ( 'app' , 'The requested page does not exist.' ) ) ; } } | Finds the Media model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown . |
57,565 | public function compareTrees ( array $ previous , array $ latest ) { $ sum = array_merge ( array_keys ( $ previous ) , array_keys ( $ latest ) ) ; $ sum = array_filter ( $ sum , 'is_string' ) ; $ sum = array_unique ( $ sum ) ; asort ( $ sum ) ; foreach ( $ sum as $ key ) { $ old = null ; if ( isset ( $ previous [ $ key... | Compare two parsed AST . |
57,566 | public function resolve ( ) { if ( empty ( $ this -> componentType ) ) { throw new \ BadMethodCallException ( 'You have to provide a component type to create a component.' ) ; } $ this -> component = new $ this -> componentClass ( ) ; $ this -> component -> setComponentType ( $ this -> componentType ) ; $ this -> compo... | Component creation method . |
57,567 | protected function getObjectByName ( ServiceLocatorInterface $ serviceLocator , $ name ) { if ( $ serviceLocator -> has ( 'Matryoshka\Model\Object\ObjectManager' ) ) { $ serviceLocator = $ serviceLocator -> get ( 'Matryoshka\Model\Object\ObjectManager' ) ; } return $ serviceLocator -> get ( $ name ) ; } | Retrieve object from service locator |
57,568 | protected function getPaginatorCriteriaByName ( ServiceLocatorInterface $ serviceLocator , $ name ) { $ criteria = $ serviceLocator -> get ( $ name ) ; if ( ! $ criteria instanceof PaginableCriteriaInterface ) { throw new Exception \ ServiceNotCreatedException ( sprintf ( 'Instance of type "%s" is invalid; must impleme... | Retrieve PaginableCriteriaInterface object from service locator |
57,569 | protected function getHydratorByName ( ServiceLocatorInterface $ serviceLocator , $ name ) { if ( $ serviceLocator -> has ( 'HydratorManager' ) ) { $ serviceLocator = $ serviceLocator -> get ( 'HydratorManager' ) ; } $ obj = $ serviceLocator -> get ( $ name ) ; if ( ! $ obj instanceof HydratorInterface ) { throw new Ex... | Retrieve HydratorInterface object from service locator |
57,570 | protected function getInputFilterByName ( ServiceLocatorInterface $ serviceLocator , $ name ) { if ( $ serviceLocator -> has ( 'InputFilterManager' ) ) { $ serviceLocator = $ serviceLocator -> get ( 'InputFilterManager' ) ; } $ obj = $ serviceLocator -> get ( $ name ) ; if ( ! $ obj instanceof InputFilterInterface ) { ... | Retrieve InputFilterInterface object from service locator |
57,571 | protected function getPrototypeStrategyByName ( ServiceLocatorInterface $ serviceLocator , $ name ) { $ obj = $ serviceLocator -> get ( $ name ) ; if ( ! $ obj instanceof PrototypeStrategyInterface ) { throw new Exception \ RuntimeException ( sprintf ( 'Instance of type %s is invalid; must implement %s' , ( is_object (... | Retrieve PrototypeStrategy object from service locator |
57,572 | public function handle ( KernelHandleInterface $ target , Request $ request ) { $ event = new KernelHandleEvent ( $ target ) ; $ this -> dispatcher -> dispatch ( KernelHandleEvent :: PRE_RUN , $ event ) ; $ response = $ target -> run ( $ request ) ; $ this -> dispatcher -> dispatch ( KernelHandleEvent :: POST_RUN , $ e... | Runs a kernel target |
57,573 | public function setRoles ( array $ roles = array ( ) ) { if ( $ this -> instance instanceof \ Phavour \ Session \ Storage ) { if ( $ this -> instance -> isLocked ( ) ) { $ this -> instance -> unlock ( ) ; } $ this -> instance -> set ( 'roles' , $ roles ) ; $ this -> instance -> lock ( ) ; return true ; } return false ;... | Set roles for a user |
57,574 | public function addToIdentity ( $ array ) { if ( $ this -> instance instanceof \ Phavour \ Session \ Storage ) { if ( $ this -> instance -> isLocked ( ) ) { $ this -> instance -> unlock ( ) ; } $ temp = $ this -> instance -> get ( 'identity' ) ; if ( ! $ temp ) { $ temp = array ( ) ; } $ newIdentity = array_merge ( $ t... | Add to the identity . This performs an array merge on the current identity so you can override anyting you need to |
57,575 | public function addRole ( $ role ) { if ( $ this -> instance instanceof \ Phavour \ Session \ Storage ) { if ( $ this -> hasRole ( $ role ) ) { return true ; } if ( $ this -> instance -> isLocked ( ) ) { $ this -> instance -> unlock ( ) ; } $ roles = $ this -> instance -> get ( 'roles' ) ; if ( is_array ( $ roles ) ) {... | Add a single role to a user |
57,576 | public function removeRole ( $ role ) { if ( $ this -> instance instanceof \ Phavour \ Session \ Storage ) { if ( ! $ this -> hasRole ( $ role ) ) { return false ; } if ( $ this -> instance -> isLocked ( ) ) { $ this -> instance -> unlock ( ) ; } $ roles = $ this -> instance -> get ( 'roles' ) ; if ( is_array ( $ roles... | Remove a single role from a user |
57,577 | public function hasRole ( $ role ) { if ( $ this -> instance instanceof \ Phavour \ Session \ Storage ) { $ roles = $ this -> instance -> get ( 'roles' ) ; if ( is_array ( $ roles ) && in_array ( $ role , $ roles ) ) { return true ; } } return false ; } | Check if a user has a given role |
57,578 | public function isLoggedIn ( ) { if ( $ this -> instance instanceof \ Phavour \ Session \ Storage ) { if ( $ this -> instance -> get ( 'identity' ) != false ) { return true ; } } return false ; } | Check if a user is logged in or not . |
57,579 | public function destroy ( ) { if ( $ this -> instance instanceof \ Phavour \ Session \ Storage ) { $ this -> instance -> destroy ( ) ; } $ this -> instance = null ; } | Destroy the instance of Storage |
57,580 | public function getValue ( ) { $ value = $ this -> getRawValue ( ) ; if ( is_array ( $ value ) ) { foreach ( $ value as $ key => $ part ) { $ value [ $ key ] = $ this -> getFilterChain ( ) -> filter ( $ part ) ; } return $ value ; } return $ this -> getFilterChain ( ) -> filter ( $ value ) ; } | Returns the value after filtered on filter chain |
57,581 | public function addFilter ( $ filter ) { try { $ this -> getFilterChain ( ) -> add ( StaticFilter :: create ( $ filter ) ) ; } catch ( FilterException $ caught ) { throw new InvalidArgumentException ( $ caught -> getMessage ( ) , 0 , $ caught ) ; } return $ this ; } | Adds a filter to the filter chain |
57,582 | function initAutoload ( LoaderAutoloadAggregate $ baseAutoloader ) { $ nameSpaceLoader = 'Poirot\Loader\Autoloader\LoaderAutoloadNamespace' ; $ nameSpaceLoader = $ baseAutoloader -> loader ( $ nameSpaceLoader ) ; $ nameSpaceLoader -> addResource ( __NAMESPACE__ , __DIR__ ) ; require_once __DIR__ . '/_functions.php' ; } | Register class autoload on Autoload |
57,583 | function getServices ( Container $ moduleContainer = null ) { $ conf = \ Poirot \ Config \ load ( __DIR__ . '/config/mod-oauth2client.services' , true ) ; return $ conf ; } | Get Nested Module Services |
57,584 | public function getPriceEstimates ( $ startLat , $ startLon , $ endLat , $ endLon ) { return $ this -> get ( '/estimates/price' , array ( 'start_latitude' => ( float ) $ startLat , 'start_longitude' => ( float ) $ startLon , 'end_latitude' => ( float ) $ endLat , 'end_longitude' => ( float ) $ endLon , ) ) ; } | The Price Estimates endpoint returns an estimated price range for each product offered at a given location . The price estimate is provided as a formatted string with the full price range and the localized currency symbol . The response also includes low and high estimates and the ISO 4217 currency code for situations ... |
57,585 | public function getTimeEstimates ( $ startLat , $ startLon , $ customerUUID = null , $ productID = null ) { $ query = array ( 'start_latitude' => ( float ) $ startLat , 'start_longitude' => ( float ) $ startLon , ) ; if ( $ customerUUID !== null ) { $ query [ 'customer_uuid' ] = $ customerUUID ; } if ( $ productID !== ... | The Time Estimates endpoint returns ETAs for all products offered at a given location with the responses expressed as integers in seconds . We recommend that this endpoint be called every minute to provide the most accurate up - to - date ETAs . |
57,586 | public function match ( string $ filename ) : bool { $ extension = pathinfo ( $ filename , PATHINFO_EXTENSION ) ; return strtolower ( $ extension ) == $ this -> extension ; } | Check if filename matches to expected extension . |
57,587 | public function parse ( string $ path ) : ? ViewPath { $ this -> validatePath ( $ path ) ; $ filename = preg_replace ( '#/{2,}#' , '/' , str_replace ( '\\' , '/' , ( string ) $ path ) ) ; $ namespace = $ this -> defaultNamespace ; if ( strpos ( $ filename , '.' ) === false ) { $ filename .= '.' . $ this -> extension ; ... | Parse view path and extract name namespace and basename information . |
57,588 | public function fetchName ( string $ filename ) : ? string { return str_replace ( '\\' , '/' , substr ( $ filename , 0 , - 1 * ( 1 + strlen ( $ this -> extension ) ) ) ) ; } | Get view name from given filename . |
57,589 | private function validatePath ( string $ path ) { if ( empty ( $ path ) ) { throw new PathException ( 'A view path is empty' ) ; } if ( false !== strpos ( $ path , "\0" ) ) { throw new PathException ( 'A view path cannot contain NUL bytes' ) ; } $ path = ltrim ( $ path , '/' ) ; $ parts = explode ( '/' , $ path ) ; $ l... | Make sure view filename is OK . Same as in twig . |
57,590 | private function checkInputs ( ) { if ( ! $ this -> disableInputCheck && ! ( $ this -> requestId && $ this -> connectId ) ) { throw new EndpointException ( "No request ID or connect ID were provided" ) ; } $ requestId = $ this -> getParam ( "request_id" ) ; $ connectId = $ this -> getParam ( "connect_id" ) ; $ code = $... | Checks given inputs |
57,591 | private function getParam ( $ key ) { if ( ! $ this -> getParams ) { $ this -> getParams = filter_input ( INPUT_GET , self :: UKEY1_GET_PARAM , FILTER_DEFAULT , FILTER_REQUIRE_ARRAY ) ; } if ( isset ( $ this -> getParams [ $ key ] ) && $ this -> getParams [ $ key ] && ( is_string ( $ this -> getParams [ $ key ] ) || is... | Gets a Ukey1 param |
57,592 | private function checkSignature ( $ signature , $ status , $ code ) { if ( ! $ signature ) { throw new EndpointException ( "Invalid signature" ) ; } $ data = $ this -> app -> getAppId ( ) . $ this -> requestId . $ this -> connectId . $ code . $ status ; $ result = openssl_verify ( $ data , $ signature , $ this -> app -... | Checks a given signature |
57,593 | private static function _reset ( ) { if ( self :: PROCMODE_FILE === self :: $ _mode && self :: $ _closeHandle && 'resource' === gettype ( self :: $ _fh ) ) fclose ( self :: $ _fh ) ; self :: $ _input = null ; self :: $ _mode = null ; self :: $ _closeHandle = true ; self :: $ _fh = null ; self :: $ _headers = array ( ) ... | Resets internal parameters |
57,594 | public static function port ( $ service , $ privatePort , array $ args = [ ] ) { $ args [ ] = $ service ; $ args [ ] = $ privatePort ; return self :: runCommand ( 'port' , $ args ) ; } | Print the public port for a port binding . |
57,595 | public static function rm ( $ force = false , $ remove_volumes = false ) { $ args = [ ] ; if ( $ force ) { $ args [ ] = '-f' ; } if ( $ remove_volumes ) { $ args [ ] = '-v' ; } return self :: runCommand ( 'rm' , $ args ) ; } | Remove stopped containers . |
57,596 | public function is_valid ( ) { $ ret = false ; if ( is_null ( $ this -> masterName ) === false && is_null ( $ this -> fromName ) === false && is_null ( $ this -> fromDomain ) === false && is_null ( $ this -> division ) === false && is_null ( $ this -> encoding ) === false && is_null ( $ this -> subject ) === false && i... | Validates an envelope |
57,597 | public function validatePayload ( $ packedPayload ) { $ messageType = $ this -> message -> getMessageType ( ) ; $ maxLength = $ this -> getPayloadMaxLength ( ) ; if ( strlen ( $ packedPayload ) > $ maxLength ) { throw new MalformedNotificationException ( sprintf ( "The maximum size allowed for '%s' notification payload... | Check if maximum size allowed for a notification payload exceeded |
57,598 | public static function getRecordTypeFormChoiceOptions ( $ label = 'Typ:' ) { return [ 'label' => $ label , 'choices' => array_combine ( self :: getRecordTypes ( ) , self :: getRecordTypes ( ) ) , 'choices_as_values' => true , 'required' => true , 'constraints' => [ new NotBlank ( ) , ] , ] ; } | Get Record Type Form Choice Options |
57,599 | public static function fixSectionLanguagesByAlphabet ( $ alphabetsFile , $ sectionsFile ) { if ( ! is_file ( $ alphabetsFile ) ) { throw new \ InvalidArgumentException ( sprintf ( 'File "%s" not found.' , $ alphabetsFile ) ) ; } if ( ! is_file ( $ sectionsFile ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Fil... | Fix section languages by alphabet |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.