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 ) * $ difference -> format ( '%r1' ) ; }
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' , $ value ) ) ; } } if ( ! is_int ( $ value ) || $ value <= 0 ) { throw new \ InvalidArgumentException ( sprintf ( 'The value "%s" is not a valid process signal value' , $ value ) ) ; } $ cleanedValues [ ] = $ value ; } return $ cleanedValues ; }
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' , 'Authorization' => 'Bearer ' . fp_env ( 'ACACHA_FORGE_ACCESS_TOKEN' ) ] ] ) ; } catch ( \ Exception $ e ) { $ this -> error ( 'And error occurs connecting to the api url: ' . $ this -> url ) ; $ this -> error ( 'Status code: ' . $ e -> getResponse ( ) -> getStatusCode ( ) . ' | Reason : ' . $ e -> getResponse ( ) -> getReasonPhrase ( ) ) ; return [ ] ; } return json_decode ( ( string ) $ response -> getBody ( ) , true ) ; }
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 ] [ 0 ] : '' ; }
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 , $ format ) ; } , $ value ) ; } } } return count ( @ $ this -> fails [ "messages" ] [ $ field ] ) ? @ $ this -> fails [ "messages" ] [ $ field ] : array ( ) ; }
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 ( ) ) , 'app' => Kernel :: getConfig ( 'app' , array ( ) ) , 'langs' => Kernel :: getConfig ( 'languages' , array ( ) ) , 'assets' => '/' . Kernel :: getPath ( 'webdocbook_assets' , true , 'web' ) , 'vendor_assets' => '/' . Kernel :: getPath ( 'vendor_assets' , true , 'web' ) , 'chapters' => WDBHelper :: getChapters ( ) , 'search_str' => $ wdb -> getRequest ( ) -> getGet ( 's' ) , 'session' => $ session -> hasFlash ( ) ? $ session -> allFlashes ( ) : 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 :: isBlockType ( $ child , NavScrollableType :: class ) ) { foreach ( $ child -> all ( ) as $ subChild ) { if ( BlockUtil :: isBlockType ( $ subChild , BlockType :: class ) ) { $ parent = $ subChild ; break 2 ; } } } } } $ block -> setAttribute ( 'block_parent_buttons' , $ parent ) ; return $ parent ; }
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 ( $ arguments , 3 ) ; $ properties = compact ( 'title' , 'attributes' ) ; } $ child = static :: make ( $ properties ) ; call_user_func ( $ callback , $ child ) ; $ this -> childs [ ] = $ child ; return $ child ; }
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' ) ; } else { $ ip = $ this -> getServer ( 'REMOTE_ADDR' ) ; } return $ ip ; }
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 ] [ 'line' ] - 1 , 0 , "use {$class};" ) ; } else { if ( ! $ token = $ testable -> findNext ( array ( T_NAMESPACE ) ) ) { $ this -> addWarning ( array ( 'message' => 'Not able to add dependency.' ) ) ; return ; } array_splice ( $ lines , $ tokens [ $ token ] [ 'line' ] , 0 , "use {$class};" ) ; array_splice ( $ lines , $ tokens [ $ token ] [ 'line' ] , 0 , "" ) ; } $ testable -> source ( implode ( "\n" , $ lines ) ) ; }
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 , $ this ) ; if ( isset ( $ result ) ) { return $ result ; } $ filters = $ this -> getFilters ( ) ; $ iterator = new Filter ( new FilesystemIterator ( $ directory ) , $ options , $ filters ) ; if ( ! empty ( $ options [ 'count' ] ) ) { return iterator_count ( $ iterator ) ; } if ( ! empty ( $ options [ 'limit' ] ) ) { list ( $ page , $ limit ) = $ options [ 'limit' ] ; $ iterator = new LimitIterator ( $ iterator , $ page , $ limit ) ; } $ result = iterator_to_array ( $ iterator ) ; $ this -> sort ( $ result , $ options [ 'sort' ] , $ options [ 'order' ] ) ; $ this -> hook -> attach ( 'module.file_manager.scan.after' , $ directory , $ options , $ result , $ this ) ; return $ result ; }
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 $ function ( $ a , $ b , $ order ) ; } ) ; } }
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 ) ; return $ filters ; }
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 ) ; return $ sorters ; }
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 OutputFormatterStyle ( 'white' , 'green' , [ ] ) ) ; }
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 -> writeln ( '<comment>Warning:</comment>' ) ; $ this -> renderWarnings ( $ withWarnings , $ output ) ; } if ( count ( $ withErrors ) === 0 && count ( $ withWarnings ) === 0 ) { $ output -> writeln ( '<success>GREAT JOB! IT\'S BEAUTIFUL</success>' ) ; return 0 ; } else { return 1 ; } }
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>' , ' ' . $ error [ 'message' ] , ] ) ; } } } }
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' , $ request -> email ) -> first ( ) ; $ ticket = Ticket :: create ( [ 'subject' => $ request -> subject , 'user_id' => User :: where ( 'email' , $ request -> email ) -> first ( ) -> id , 'open' => true , 'admin_id' => Auth :: id ( ) , ] ) ; if ( Settings :: first ( ) -> text_editor == 'markdown' ) { $ msg = Markdown :: convertToHtml ( $ request -> message ) ; } elseif ( Settings :: first ( ) -> text_editor == 'wysiwyg' ) { $ msg = $ request -> message ; } else { $ msg = htmlentities ( $ request -> message ) ; } Message :: create ( [ 'message' => $ msg , 'ticket_id' => $ ticket -> id , 'user_id' => Auth :: id ( ) , ] ) ; return redirect ( ) -> route ( 'laralum::tickets.show' , [ 'ticket' => $ ticket -> id ] ) -> with ( 'success' , __ ( 'laralum_tickets::general.created' ) ) ; }
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 ( $ event -> socket , ( string ) $ message , $ flag , $ event -> peer ) ; }
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 , MigrationScriptInterface :: class ) ) { throw new \ Error ( 'Non-MigrationScriptInterface object provided to MigrationManager: `' . $ migrationScript . '`' ) ; } if ( $ migrationScript -> version ( ) < $ from || $ migrationScript -> version ( ) > $ to || array_search ( $ scriptClass , $ skipScripts ) !== false ) { continue ; } if ( $ provider -> isScriptComplete ( $ scriptClass ) ) { continue ; } $ migrationScripts [ ] = $ migrationScript ; } usort ( $ migrationScripts , function ( MigrationScriptInterface $ a , MigrationScriptInterface $ b ) { return $ a -> version ( ) <=> $ b -> version ( ) ; } ) ; return $ migrationScripts ; }
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 [ $ lineIndex ] ) ; } } return count ( $ output ) ; }
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!' ) ; } $ selection = $ helper -> choice ( $ question , $ choice ) ; $ selectionId = array_search ( $ selection , $ choice ) ; return CollectionUtility :: find ( $ entities , $ selectionId ) ; }
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 table is %s.' , gettype ( $ array ) ) , ] ) ; } $ rows = [ ] ; foreach ( $ array as $ index => $ value ) { $ rows [ ] = [ $ index , self :: getStringForTable ( $ value ) , ] ; } try { $ helper -> table ( [ ] , $ rows ) ; } catch ( ContextErrorException $ error ) { print_r ( $ rows ) ; $ helper -> error ( [ 'Table failed with error:' , $ error -> getMessage ( ) , ] ) ; } }
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 -> format ( 'Y-m-d H:i:s' ) ; } if ( null === $ value ) { return 'NULL' ; } if ( true === is_array ( $ value ) ) { $ result = [ ] ; foreach ( $ value as $ arrayIndex => $ arrayValue ) { if ( true === is_numeric ( $ arrayIndex ) ) { $ result [ ] = self :: getStringForTable ( $ arrayValue ) ; continue ; } $ result [ ] = sprintf ( '%s : %s' , $ arrayIndex , self :: getStringForTable ( $ arrayValue ) ) ; } return implode ( PHP_EOL , $ result ) ; } return json_encode ( $ 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 = sprintf ( "Connection not allowed for these domains [%s] in %s configuration" , implode ( ', ' , array_values ( $ configuration ) [ 0 ] [ 'domain' ] ) , $ connectionName ) ; } else { $ errorReport = sprintf ( "Connection not allowed for domain {%s} in {%s} configuration." , array_values ( $ configuration ) [ 0 ] [ 'domain' ] [ 0 ] , $ connectionName ) ; } throw new RuntimeException ( $ errorReport ) ; } else { throw new RuntimeException ( sprintf ( "Connection not allowed for domain {%s} in {%s} configuration." , array_values ( $ configuration ) [ 0 ] [ 'domain' ] , $ connectionName ) ) ; } pre ( $ config ) ; exit ; }
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' , $ callback ) ) ; } $ r = new ReflectionClass ( $ class ) ; if ( ! $ r -> hasMethod ( $ method ) ) { throw new Exception ( sprintf ( 'Static method call "%s" refers to a method that does not exist' , $ callback ) ) ; } $ m = $ r -> getMethod ( $ method ) ; if ( ! $ m -> isStatic ( ) ) { throw new Exception ( sprintf ( 'Static method call "%s" refers to a method that is not static' , $ callback ) ) ; } return array ( $ class , $ method ) ; }
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 ( 'success' , __ ( 'laralum_profile::general.profile_updated' ) ) ; }
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_profile::general.incorrect_password' ) ; } if ( $ request -> hasFile ( 'picture' ) ) { $ this -> validate ( $ request , [ 'picture' => 'image|max:5120' , ] ) ; if ( $ request -> file ( 'picture' ) -> isValid ( ) ) { $ request -> file ( 'picture' ) -> move ( public_path ( '/avatars' ) , md5 ( $ user -> email ) ) ; } else { return __ ( 'laralum_profile::general.image_not_valid' ) ; } } else { if ( $ user -> hasAvatar ( ) ) { if ( ! $ request -> save_picture ) { File :: delete ( public_path ( '/avatars/' . md5 ( $ user -> email ) ) ) ; } } } if ( $ request -> password ) { $ this -> validate ( $ request , [ 'password' => 'min:6|confirmed' , ] ) ; $ user -> update ( [ 'password' => $ request -> password ] ) ; } if ( $ request -> name ) { $ user -> update ( [ 'name' => $ request -> name ] ) ; } return 0 ; }
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 , $ app , $ templateType ) ; }
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 :: create ( ) -> in ( $ found ) ; }
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 ( 'index' , [ 'searchModel' => $ searchModel , 'dataProvider' => $ dataProvider , ] ) ; }
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 ] ) ) { $ old = $ previous [ $ key ] ; } $ new = null ; if ( isset ( $ latest [ $ key ] ) ) { $ new = $ latest [ $ key ] ; } $ this -> handleNode ( $ old , $ new ) ; if ( $ old && $ new ) { foreach ( $ old -> getSubNodeNames ( ) as $ subNode ) { if ( ! is_array ( $ old -> $ subNode ) ) { continue ; } $ this -> compareTrees ( $ old -> $ subNode , $ new -> $ subNode ) ; } } } return null ; }
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 -> component -> setData ( $ this -> data ) ; $ this -> assertEntityIsValid ( $ this -> component , array ( 'Component' , 'creation' ) ) ; $ this -> fireEvent ( ComponentEvents :: COMPONENT_CREATED , new ComponentEvent ( $ this -> component , $ this ) ) ; return $ this -> component ; }
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 implement "%s"' , ( is_object ( $ criteria ) ? get_class ( $ criteria ) : gettype ( $ criteria ) ) , PaginableCriteriaInterface :: class ) ) ; } return $ criteria ; }
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 Exception \ RuntimeException ( sprintf ( 'Instance of type %s is invalid; must implement %s' , ( is_object ( $ obj ) ? get_class ( $ obj ) : gettype ( $ obj ) ) , HydratorInterface :: class ) ) ; } return $ obj ; }
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 ) { throw new Exception \ RuntimeException ( sprintf ( 'Instance of type %s is invalid; must implement %s' , ( is_object ( $ obj ) ? get_class ( $ obj ) : gettype ( $ obj ) ) , InputFilterInterface :: class ) ) ; } return $ obj ; }
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 ( $ obj ) ? get_class ( $ obj ) : gettype ( $ obj ) ) , PrototypeStrategyInterface :: class ) ) ; } return $ obj ; }
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 , $ event ) ; return $ response ; }
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 ( $ temp , $ array ) ; $ this -> instance -> set ( 'identity' , $ newIdentity ) ; $ this -> instance -> lock ( ) ; return true ; } return false ; }
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 ) ) { $ this -> instance -> set ( 'roles' , array_merge ( $ roles , array ( $ role ) ) ) ; } else { $ this -> instance -> set ( 'roles' , array ( $ role ) ) ; } $ this -> instance -> lock ( ) ; return true ; } return false ; }
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 ) ) { $ new = array ( ) ; foreach ( $ roles as $ old ) { if ( $ old != $ role ) { $ new [ ] = $ old ; } } $ this -> instance -> set ( 'roles' , $ new ) ; } $ this -> instance -> lock ( ) ; return true ; } return false ; }
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 requiring currency conversion . When surge is active for a particular product its surge_multiplier will be greater than 1 but the price estimate already factors in this multiplier .
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 !== null ) { $ query [ 'product_id' ] = $ productID ; } return $ this -> get ( '/estimates/time' , $ query ) ; }
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 ; } elseif ( ! $ this -> match ( $ filename ) ) { return null ; } if ( strpos ( $ filename , LoaderInterface :: NS_SEPARATOR ) !== false ) { list ( $ namespace , $ filename ) = explode ( LoaderInterface :: NS_SEPARATOR , $ filename ) ; } if ( isset ( $ filename [ 0 ] ) && $ filename [ 0 ] == '@' ) { $ separator = strpos ( $ filename , '/' ) ; if ( $ separator === false ) { throw new PathException ( sprintf ( 'Malformed view path"%s" (expecting "@namespace/name").' , $ path ) ) ; } $ namespace = substr ( $ filename , 1 , $ separator - 1 ) ; $ filename = substr ( $ filename , $ separator + 1 ) ; } return new ViewPath ( $ namespace , $ this -> fetchName ( $ filename ) , $ filename ) ; }
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 ) ; $ level = 0 ; foreach ( $ parts as $ part ) { if ( '..' === $ part ) { -- $ level ; } elseif ( '.' !== $ part ) { ++ $ level ; } if ( $ level < 0 ) { throw new PathException ( sprintf ( 'Looks like you try to load a view outside configured directories (%s)' , $ path ) ) ; } } }
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 = $ this -> getParam ( "code" ) ; $ signature = $ this -> getParam ( "signature" ) ; $ status = $ this -> getParam ( "result" ) ; if ( ! $ this -> disableInputCheck ) { if ( $ this -> requestId != $ requestId ) { throw new EndpointException ( "Invalid request ID" ) ; } if ( $ this -> connectId != $ connectId ) { throw new EndpointException ( "Invalid connect ID" ) ; } } if ( $ status == self :: STATUS_AUTHORIZED ) { if ( ! $ code ) { throw new EndpointException ( "No auth code" ) ; } } $ this -> checkSignature ( base64_decode ( $ signature , true ) , $ status , $ code ) ; return ( $ status == self :: STATUS_AUTHORIZED ) ; }
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_numeric ( $ this -> getParams [ $ key ] ) ) ) { return $ this -> getParams [ $ key ] ; } else { return "" ; } }
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 -> getSecretKey ( ) , OPENSSL_ALGO_SHA512 ) ; if ( $ result < 1 ) { $ errstr = openssl_error_string ( ) ; throw new EndpointException ( "Invalid signature or an openssl error (" . ( $ errstr ? $ errstr : "-" ) . ")" ) ; } }
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 ( ) ; self :: $ _lineNum = 0 ; self :: $ _rns = 0 ; self :: $ _headerNum = 0 ; self :: $ _possibleHeader = array ( ) ; self :: $ _innerHeaderLineCount = 0 ; self :: $ _bodyStartByteOffset = 0 ; }
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 && is_null ( $ this -> deliveryType ) === false && is_null ( $ this -> friendlyFrom ) === false && is_null ( $ this -> description ) === false && is_null ( $ this -> campaign ) === false ) { $ ret = true ; } return $ ret ; }
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 is %d bytes" , $ messageType , $ maxLength ) ) ; } }
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 ( 'File "%s" not found.' , $ sectionsFile ) ) ; } $ sections = Yaml :: parse ( $ sectionsFile ) ; $ alphabets = Yaml :: parse ( $ alphabetsFile ) ; if ( ! $ sections || ! $ alphabets ) { return ; } foreach ( $ alphabets as $ language => $ alphabetInfo ) { $ alphabetChars = Unicode :: ordStr ( $ alphabetInfo [ 'chars' ] ) ; $ availableSections = array ( ) ; foreach ( $ alphabetChars as $ char ) { foreach ( $ sections as $ section => $ sectionInfo ) { list ( $ diapMin , $ diapMax ) = $ sectionInfo [ 'diap' ] ; if ( $ char >= $ diapMin && $ char <= $ diapMax ) { $ availableSections [ ] = $ section ; } } } if ( count ( $ availableSections ) ) { foreach ( $ availableSections as $ availableSection ) { if ( ! is_array ( $ sections [ $ availableSection ] [ 'languages' ] ) ) { $ sections [ $ availableSection ] [ 'languages' ] = array ( ) ; } if ( ! in_array ( $ language , $ sections [ $ availableSection ] [ 'languages' ] ) ) { $ sections [ $ availableSection ] [ 'languages' ] [ ] = $ language ; } } } } file_put_contents ( $ sectionsFile , Yaml :: dump ( $ sections ) ) ; }
Fix section languages by alphabet