idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
57,000
public function setTime ( $ hour , $ minute , $ second = 0 ) { parent :: setTime ( $ hour , $ minute , $ second ) ; return $ this ; }
Set the time all together
57,001
public function diffInMinutes ( Time $ dt = null , $ abs = true ) { return ( int ) ( $ this -> diffInSeconds ( $ dt , $ abs ) / self :: SECONDS_PER_MINUTE ) ; }
Get the difference in minutes
57,002
public function connect ( ) { $ this -> errorHandler -> start ( ) ; $ methods = array ( ) ; if ( $ this -> configuration -> getAuthType ( ) !== 'pass' ) { $ methods [ 'hostkey' ] = $ this -> configuration -> getAuthType ( ) ; } if ( ( $ this -> sshResource = $ this -> driver -> connect ( $ this -> configuration -> getH...
Standard function for creating a SFTP connection and logging in .
57,003
public function put ( $ local , $ remote ) { $ this -> errorHandler -> start ( ) ; if ( $ this -> driver -> scpSend ( $ this -> resource , $ local , $ remote ) ) { $ this -> errorHandler -> stop ( ) ; return true ; } $ this -> errorHandler -> stop ( ) ; return false ; }
Put a local file up to a remote server .
57,004
public function fget ( $ remote ) { if ( $ remote == '' || substr ( $ remote , 0 , 1 ) !== '/' ) { $ remote = $ this -> dir . '/' . $ remote ; } $ this -> errorHandler -> start ( ) ; if ( ( $ handle = $ this -> driver -> sftpFopen ( $ this -> resource , $ remote , 'r+' ) ) !== false ) { rewind ( $ handle ) ; $ this -> ...
Similar to get but does not save file locally .
57,005
public function cd ( $ dir = '' ) { if ( $ dir == '' || substr ( $ dir , 0 , 1 ) !== '/' ) { $ dir = $ this -> dir . '/' . $ dir ; } $ this -> errorHandler -> start ( ) ; if ( ( $ dir = $ this -> driver -> realpath ( $ this -> resource , $ dir ) ) !== false ) { $ this -> dir = $ dir ; $ this -> errorHandler -> stop ( )...
Change the current working directory on the remote machine .
57,006
public function mv ( $ sourcepath , $ destpath ) { $ this -> errorHandler -> start ( ) ; if ( $ sourcepath == '' || substr ( $ sourcepath , 0 , 1 ) !== '/' ) { $ sourcepath = $ this -> dir . '/' . $ sourcepath ; } if ( $ destpath == '' || substr ( $ destpath , 0 , 1 ) !== '/' ) { $ destpath = $ this -> dir . '/' . $ de...
Move a remote file to a new location on the remote server .
57,007
public function rm ( $ sourcepath ) { if ( $ sourcepath == '' || substr ( $ sourcepath , 0 , 1 ) !== '/' ) { $ sourcepath = $ this -> dir . '/' . $ sourcepath ; } $ this -> errorHandler -> start ( ) ; if ( ( $ sourcepath = $ this -> driver -> realpath ( $ this -> resource , $ sourcepath ) ) !== false ) { if ( $ this ->...
Remove a file from the remote file system .
57,008
public function run ( ) { if ( ! $ this -> isAppRootSet ( ) ) { throw new Exception ( "The application root wasn't defined." , 1 ) ; } if ( ! $ this -> isConfigFileSet ( ) ) { throw new Exception ( "The main config file wasn't defined." , 2 ) ; } $ sConfigPath = $ this -> getAppRoot ( ) . $ this -> getConfigFile ( ) ; ...
It loads main file of configuration and checks for validity .
57,009
private static function getBaseUrl ( ) { if ( isset ( $ _SERVER [ 'SERVER_NAME' ] ) ) { $ sProtocol = ! empty ( $ _SERVER [ 'HTTPS' ] ) && strtolower ( $ _SERVER [ 'HTTPS' ] ) == 'on' ? 'https' : 'http' ; return $ sProtocol . '://' . $ _SERVER [ 'SERVER_NAME' ] ; } return null ; }
It determines the basic site URL .
57,010
public function getComponentRoot ( $ sName ) { $ aRootMap = $ this -> getConfig ( 'componentsRootMap' ) ; return isset ( $ aRootMap [ $ sName ] ) ? $ this -> getAppRoot ( ) . $ aRootMap [ $ sName ] : null ; }
The method returns full path to the parent directory of component by its name .
57,011
public function branches ( string $ user , string $ repo ) : array { $ default = [ ] ; $ api = $ this -> client -> api ( 'git_data' ) -> references ( ) ; $ params = [ $ api , 'branches' , [ $ user , $ repo ] ] ; $ refs = $ this -> callGitHub ( [ $ this -> pager , 'fetchAll' ] , $ params , $ default ) ; array_walk ( $ r...
Get the reference data for branches for a repository .
57,012
public function pullRequests ( string $ user , string $ repo , array $ filter = [ ] ) : array { $ default = [ ] ; $ api = $ this -> client -> api ( 'pull_request' ) ; $ params = [ $ user , $ repo , $ filter ] ; $ refs = $ this -> callGitHub ( [ $ api , 'all' ] , $ params , $ default ) ; usort ( $ refs , $ this -> prSor...
Get all pull requests for a repository .
57,013
public function pullRequest ( string $ user , string $ repo , string $ number ) : ? array { $ api = $ this -> client -> api ( 'pull_request' ) ; $ params = [ $ user , $ repo , $ number ] ; $ refs = $ this -> callGitHub ( [ $ api , 'show' ] , $ params ) ; return is_array ( $ refs ) ? $ refs : null ; }
Get metadata for a specific pull request .
57,014
public function repository ( string $ user , string $ repo ) : ? array { $ api = $ this -> client -> api ( 'repo' ) ; $ params = [ $ user , $ repo ] ; $ repo = $ this -> callGitHub ( [ $ api , 'show' ] , $ params ) ; return is_array ( $ repo ) ? $ repo : null ; }
Get the extended metadata for a repository .
57,015
public function tags ( string $ user , string $ repo ) : array { $ default = [ ] ; $ api = $ this -> client -> api ( 'git_data' ) -> references ( ) ; $ params = [ $ api , 'tags' , [ $ user , $ repo ] ] ; $ refs = $ this -> callGitHub ( [ $ this -> pager , 'fetchAll' ] , $ params , $ default ) ; array_walk ( $ refs , fu...
Get the reference data for tags for a repository .
57,016
public function diff ( string $ user , string $ repo , string $ base , string $ head ) { $ api = $ this -> client -> api ( 'repo' ) -> commits ( ) ; $ params = [ $ user , $ repo , $ base , $ head ] ; return $ this -> callGitHub ( [ $ api , 'compare' ] , $ params ) ; }
Compare two git commits
57,017
private function _collapseType ( $ src , $ default ) { $ type = gettype ( $ src ) ; $ typeTargetd = gettype ( $ default ) ; switch ( $ typeTargetd ) { case 'integer' : if ( $ type == "string" || $ type == "integer" ) { return intval ( $ src ) ; } break ; case 'double' : if ( $ type == "string" || $ type == "integer" ||...
Check type of src with default
57,018
private function isEmpty ( $ type ) { switch ( $ type ) { case static :: GET : $ global = & $ _GET ; break ; case static :: POST : $ global = & $ this -> _getPost ( ) ; break ; case static :: SESSION : $ global = & $ _SESSION ; break ; default : throw new \ Exception ( "Unknown global type : " . $ type ) ; break ; } re...
Return if the var is empty
57,019
private function unsetGlobal ( $ var , $ type ) { switch ( $ type ) { case static :: GET : $ global = & $ _GET ; break ; case static :: POST : $ global = & $ this -> _getPost ( ) ; break ; case static :: SESSION : $ global = & $ _SESSION ; break ; default : throw new \ Exception ( "Unknown global type : " . $ type ) ; ...
Unset a var
57,020
function findOneMatchBy ( $ property , $ value ) { switch ( $ property ) { case 'owner_identifier' : return $ this -> federation -> getAccountInfoByUid ( $ value ) ; break ; default : throw new \ Exception ( sprintf ( 'Identity Provider Can`t Attain with (%s).' , $ property ) ) ; } }
Finds a user by the given user Identity .
57,021
public function validateMetadata ( $ requestedType , EntityMetadata $ metadata , MetadataFactory $ mf ) { if ( $ requestedType !== $ metadata -> type ) { throw MetadataException :: invalidMetadata ( $ requestedType , 'Metadata type mismatch.' ) ; } $ this -> validateMetadataType ( $ metadata ) ; if ( null === $ metadat...
Validates EntityMetadata .
57,022
public function validateMetadataType ( EntityMetadata $ metadata ) { if ( true === $ metadata -> isChildEntity ( ) ) { $ parentType = $ metadata -> getParentEntityType ( ) ; if ( 0 !== strpos ( $ metadata -> type , $ parentType ) ) { throw MetadataException :: invalidMetadata ( $ metadata -> type , sprintf ( 'Child cla...
Validates the proper entity type on EntityMetadata .
57,023
public function validateMetadataInheritance ( EntityMetadata $ metadata , MetadataFactory $ mf ) { if ( true === $ metadata -> isPolymorphic ( ) ) { foreach ( $ metadata -> ownedTypes as $ child ) { if ( false === $ this -> isEntityTypeValid ( $ child ) ) { throw MetadataException :: invalidMetadata ( $ metadata -> typ...
Validates the proper entity inheritance on EntityMetadata .
57,024
public function validateMetadataAttributes ( AttributeInterface $ metadata , MetadataFactory $ mf ) { $ type = $ metadata instanceof EntityMetadata ? $ metadata -> type : ( property_exists ( $ metadata , 'name' ) ? $ metadata -> name : '' ) ; foreach ( $ metadata -> getAttributes ( ) as $ key => $ attribute ) { if ( $ ...
Validates entity attributes on the AttributeInterface .
57,025
protected function formatValue ( $ format , $ value ) { switch ( $ format ) { case 'dash' : return $ this -> inflector -> dasherize ( $ value ) ; case 'underscore' : return $ this -> inflector -> underscore ( $ value ) ; case 'studlycaps' : return $ this -> inflector -> studlify ( $ value ) ; case 'camelcase' : return ...
Formats a value based on a formatting type .
57,026
public function setRoute ( array $ methods , string $ regexp , $ callable ) : RouteInterface { return $ this -> setMethods ( $ methods ) -> setRegexp ( $ regexp ) -> setCallback ( $ callable ) ; }
Set single route
57,027
public function setRegexp ( string $ regexp ) : RouteInterface { $ pattern = [ '/</' , '/>/' ] ; $ replace = [ '(?P<' , '>.+)' ] ; $ regexp = preg_replace ( $ pattern , $ replace , $ regexp ) ; $ this -> _regexp = '#^' . $ regexp . '$#u' ; return $ this ; }
Set regexp of current route
57,028
public function route ( string $ method , string $ path ) : Route { if ( ! HttpMethod :: isValid ( $ method ) ) { throw new \ InvalidArgumentException ( "Invalid HTTP method '$method'" ) ; } $ this -> allowedMethods = [ ] ; $ segments = split_segments ( $ path ) ; $ routes = $ this -> matchRoutes ( $ method , $ segment...
Routes the given path with the given HTTP request method to a specific route .
57,029
private function matchRoutes ( string $ method , array $ segments ) : array { $ staticIds = $ this -> provider -> getRoutesByStaticPath ( implode ( '/' , $ segments ) ) ; if ( $ staticIds !== [ ] ) { $ routes = $ this -> getMatchingRoutes ( $ staticIds , $ method , $ segments ) ; if ( $ routes !== [ ] ) { return $ rout...
Returns routes that match the given HTTP request method and path segments .
57,030
private function getDynamicRouteIds ( array $ segments ) : array { $ matched = [ ] ; $ index = 0 ; do { $ matched [ ] = $ this -> provider -> getRoutesBySegmentValue ( $ index , $ segments [ $ index ] ) + $ this -> provider -> getRoutesBySegmentValue ( $ index , RouteDefinition :: DYNAMIC_SEGMENT ) ; $ index ++ ; } whi...
Returns a list of route ids for dynamic routes that have matching static path segments .
57,031
private function getMatchingRoutes ( array $ ids , string $ method , array $ segments ) : array { $ routes = [ ] ; foreach ( $ ids as $ id ) { $ definition = $ this -> provider -> getRouteDefinition ( $ id ) ; $ values = [ ] ; if ( ! $ definition -> matchPatterns ( $ segments , $ values ) ) { continue ; } if ( ! $ defi...
Returns the routes for the given ids that match the requested method and segments .
57,032
public function generateUrl ( string $ name , array $ parameters = [ ] ) : string { $ definition = $ this -> provider -> getRouteDefinitionByName ( $ name ) ; return $ definition -> formatUrl ( $ parameters ) ; }
Returns the encoded URL for the route with the given name .
57,033
public function finalize ( ) { if ( ! $ this -> finalized ) { foreach ( $ this -> getRoutes ( ) as $ route ) { $ route -> finalize ( ) ; $ this -> addRoute ( $ route -> getMethods ( ) , $ route -> getPattern ( ) , [ $ route , 'run' ] ) ; } $ this -> finalized = true ; } }
Finalize registered routes in preparation for dispatching .
57,034
public function getNamedRoute ( $ name ) { if ( is_null ( $ this -> namedRoutes ) ) { $ this -> buildNameIndex ( ) ; } if ( ! isset ( $ this -> namedRoutes [ $ name ] ) ) { throw new RuntimeException ( 'Named route does not exist for name: ' . $ name ) ; } return $ this -> namedRoutes [ $ name ] ; }
Get named route object .
57,035
public function urlFor ( $ name , array $ data = [ ] , array $ queryParams = [ ] ) { trigger_error ( 'urlFor() is deprecated. Use pathFor() instead.' , E_USER_DEPRECATED ) ; return $ this -> pathFor ( $ name , $ data , $ queryParams ) ; }
Build the path for a named route .
57,036
protected function buildNameIndex ( ) { $ this -> namedRoutes = [ ] ; foreach ( $ this -> routes as $ route ) { $ name = $ route -> getName ( ) ; if ( $ name ) { $ this -> namedRoutes [ $ name ] = $ route ; } } }
Build index of named routes .
57,037
public function addOrderBy ( QueryBuilder $ queryBuilder , Request $ request , TableModel $ table ) { $ sorting = $ table -> getSorting ( ) ; $ rootAlias = $ this -> getRootAlias ( $ queryBuilder ) ; $ orderByField = $ request -> query -> get ( 'order_by' , null ) ; $ orderDirection = $ request -> query -> get ( 'order...
Add Order By
57,038
public function saveTableToSession ( Request $ request , TableModel $ table ) { $ request -> getSession ( ) -> set ( TableModel :: buildSessionPath ( $ request ) , serialize ( $ table ) ) ; }
Save Table To Session
57,039
public function loadTableFromSession ( Request $ request ) { $ table = $ request -> getSession ( ) -> get ( TableModel :: buildSessionPath ( $ request ) ) ; if ( true === is_string ( $ table ) ) { return unserialize ( $ table ) ; } return null ; }
Load Table From Session
57,040
public function get ( $ sKey = '' ) { if ( empty ( $ sKey ) ) { return $ this -> store ; } else { return isset ( $ this -> store [ $ sKey ] ) ? $ this -> store [ $ sKey ] : null ; } }
It returns the variable value getted by the name from the storage .
57,041
public function handle ( ) { if ( ! auth ( ) -> user ( ) ) { return false ; } publish ( 'search' , 'scripts.resources' ) ; $ search = Input :: get ( 'search' ) ; $ string = serialize ( [ 'protection_string' => config ( 'antares/search::protection_string' ) , 'app_key' => env ( 'APP_KEY' ) , 'time' => time ( ) ] ) ; $ p...
up component search placeholder
57,042
public function flush ( ) { try { $ this -> helper -> recursivelyDeleteFromDirectory ( $ this -> path ) ; return true ; } catch ( \ Exception $ e ) { } return false ; }
Flush all existing Cache .
57,043
private function getFolderPathFromMd5 ( $ md5 ) { $ folderOne = substr ( $ md5 , 0 , 2 ) ; $ folderTwo = substr ( $ md5 , 2 , 2 ) ; return $ folderOne . self :: DS . $ folderTwo ; }
Get a folder path from a given MD5
57,044
public function squash ( ) : Collection { if ( count ( $ this -> stack ) || ! ( $ this -> array instanceof \ ArrayObject ) ) { $ this -> array = new \ ArrayObject ( iterator_to_array ( $ this ) ) ; $ this -> stack = [ ] ; $ this -> iterator = $ this -> array -> getIterator ( ) ; } return $ this ; }
Applies all pending operations
57,045
public function count ( ) { if ( count ( $ this -> stack ) || ! ( $ this -> array instanceof \ Countable ) ) { $ this -> squash ( ) ; } return $ this -> array -> count ( ) ; }
Get the collection length
57,046
public function extend ( $ source ) : Collection { if ( ! is_array ( $ source ) ) { $ source = iterator_to_array ( $ source ) ; } return new static ( array_merge ( $ this -> toArray ( ) , $ source ) ) ; }
Append more values to the collection
57,047
public function flatten ( ) : Collection { $ rslt = [ ] ; $ temp = $ this -> toArray ( ) ; foreach ( $ temp as $ v ) { $ rslt = array_merge ( $ rslt , is_array ( $ v ) ? $ v : [ $ v ] ) ; } return new static ( $ rslt ) ; }
Perform a shallow flatten of the collection
57,048
public function first ( int $ count = 1 ) : Collection { $ i = 0 ; $ new = [ ] ; foreach ( $ this as $ k => $ v ) { if ( ++ $ i > $ count ) { break ; } $ new [ $ k ] = $ v ; } return new static ( $ new ) ; }
Get the first X items from the collection
57,049
public function shuffle ( ) : Collection { $ temp = $ this -> toArray ( ) ; $ keys = array_keys ( $ temp ) ; shuffle ( $ keys ) ; $ rslt = [ ] ; foreach ( $ keys as $ key ) { $ rslt [ $ key ] = $ temp [ $ key ] ; } return new static ( $ rslt ) ; }
Shuffle the values in the collection
57,050
public function unique ( ) : Collection { $ temp = $ this -> toArray ( ) ; $ rslt = [ ] ; foreach ( $ temp as $ k => $ v ) { if ( ! in_array ( $ v , $ rslt , true ) ) { $ rslt [ $ k ] = $ v ; } } return new static ( $ rslt ) ; }
Leave only unique items in the collection
57,051
public function where ( array $ properties , $ strict = true ) : Collection { return $ this -> filter ( function ( $ v ) use ( $ properties , $ strict ) { return $ this -> whereCallback ( $ v , $ properties , $ strict ) ; } ) ; }
Filter items from the collection using key = > value pairs
57,052
public function zip ( $ keys ) : Collection { if ( ! is_array ( $ keys ) ) { $ keys = iterator_to_array ( $ keys ) ; } return new static ( array_combine ( $ keys , $ this -> toArray ( ) ) ) ; }
Combine all the values from the collection with a key
57,053
public function all ( callable $ iterator ) : bool { foreach ( $ this as $ k => $ v ) { if ( ! call_user_func ( $ iterator , $ v , $ k , $ this ) ) { return false ; } } return true ; }
Do all of the items in the collection match a given criteria
57,054
public function contains ( $ needle ) : bool { foreach ( $ this as $ k => $ v ) { if ( $ v === $ needle ) { return true ; } } return false ; }
Does the collection contain a given value
57,055
public function min ( ) { $ min = null ; $ first = false ; foreach ( $ this as $ v ) { if ( ! $ first || $ v < $ min ) { $ min = $ v ; $ first = true ; } } return $ min ; }
Get the minimal item in the collection
57,056
public function max ( ) { $ max = null ; $ first = false ; foreach ( $ this as $ v ) { if ( ! $ first || $ v > $ max ) { $ max = $ v ; $ first = true ; } } return $ max ; }
Get the maximum item in the collection
57,057
public function reduce ( callable $ iterator , $ initial = null ) { foreach ( $ this as $ k => $ v ) { $ initial = $ iterator ( $ initial , $ v , $ k , $ this ) ; } return $ initial ; }
Reduce the collection to a single value
57,058
public function createOauth ( array $ config = [ ] ) { return new Oauth1 ( array_merge ( $ this -> config , [ 'token' => $ this -> tokenStorage -> getAccessToken ( ) , 'token_secret' => $ this -> tokenStorage -> getAccessTokenSecret ( ) , ] , $ config ) ) ; }
Create an OAuth signer and optionally override some of the default config options .
57,059
public function bin_dumpfile ( $ files , $ user_vars , $ filename , $ flags = 0 , $ context = null ) { return apc_bin_dumpfile ( $ files , $ user_vars , $ filename , $ flags , $ context ) ; }
Output a binary dump of the given files and user variables from the APC cache to the named file
57,060
public function compile_file ( $ file_name = '' , $ atomic = false ) { if ( empty ( $ file_name ) ) return false ; return apc_compile_file ( $ file_name , $ atomic ) ; }
Stores a file in the bytecode cache bypassing all filters
57,061
public function setAttribute ( $ name , $ value = null ) { $ this -> getAttributes ( ) -> set ( $ name , $ value ) ; return $ this ; }
Set an HTML tag attribute
57,062
public function getAttribute ( $ name , $ default = null ) { $ value = $ default ; if ( $ this -> hasAttribute ( $ name ) ) { $ value = $ this -> attributes -> get ( $ name ) ; } return $ value ; }
Gets the value of the attribute with the provided name
57,063
protected function check ( $ env_var , $ functionName ) { if ( $ value = fp_env ( $ env_var , null ) ) { if ( $ this -> $ functionName ( ) ) { return $ value ; } $ this -> error ( "Be careful! The $env_var you provided doesn't match Laravel Forge server" ) ; return "<error>$value</error>" ; } else { return 'Not availab...
Check and obtain ip .
57,064
public static function getRootPath ( ) { if ( is_null ( static :: $ _filePath ) ) { if ( defined ( 'APPLICATION_PATH' ) ) { static :: $ _filePath = APPLICATION_PATH ; } else { static :: $ _filePath = dirname ( dirname ( __FILE__ ) ) ; } } return static :: $ _filePath ; }
Retrieve real root path with last directory separator
57,065
public static function backtrace ( $ return = false , $ html = true , $ withArgs = true ) { $ trace = debug_backtrace ( ) ; return static :: trace ( $ trace , $ return , $ html , $ withArgs ) ; }
Prints or return a backtrace
57,066
public static function trace ( array $ trace , $ return = false , $ html = true , $ withArgs = true ) { $ out = '' ; if ( $ html ) { $ out .= '<pre>' ; } foreach ( $ trace as $ i => $ data ) { if ( $ i == 0 ) { continue ; } $ args = array ( ) ; if ( isset ( $ data [ 'args' ] ) && true === $ withArgs ) { foreach ( $ dat...
Prints or return a trace
57,067
protected static function _formatCalledArgument ( $ arg ) { $ out = '' ; if ( is_object ( $ arg ) ) { $ out .= sprintf ( "&%s#%s#" , get_class ( $ arg ) , spl_object_hash ( $ arg ) ) ; } else if ( is_resource ( $ arg ) ) { $ out .= '#[' . get_resource_type ( $ arg ) . ']' ; } else if ( Arrays :: isArray ( $ arg ) ) { $...
Format argument in called method
57,068
public function migrate ( ) : array { $ result = $ this -> getFactory ( ) -> createPropelCommandProvider ( ) -> execute ( 'migration:diff' ) ; return array_merge ( $ result , $ this -> getFactory ( ) -> createPropelCommandProvider ( ) -> execute ( 'migration:migrate' ) ) ; }
Runs all migrations
57,069
private function obtenerControlador ( $ nombre , Peticion $ peticion , Respuesta $ respuesta , Ruta $ ruta ) { $ clase = $ nombre . 'Controlador' ; if ( ! class_exists ( $ clase ) ) { $ archivo = $ this -> dirApp . DIRECTORY_SEPARATOR . 'controladores' . DIRECTORY_SEPARATOR . str_replace ( '\\' , DIRECTORY_SEPARATOR , ...
Devuelve la instancia del controlador usando su nombre .
57,070
public static function detect ( $ html , & $ error = '' ) { if ( class_exists ( 'Whoops\Run' ) ) { return false ; } if ( strpos ( $ html , '<h2>Message</h2> <pre>' ) != false ) { preg_match ( '/<h2>Message<\/h2> <pre>(.*)<\/pre>/' , $ html , $ output_array ) ; $ error = trim ( strip_tags ( $ output_array [ 0 ] ) ) ; re...
Function detect Takes care of detecting if a Basic error was passed and if true extracting the error code to return it by reference
57,071
public function forkAndRunService ( $ bootstrap ) { if ( ! is_callable ( $ bootstrap ) ) { throw new \ RuntimeException ( '$bootstrap must be callable.' ) ; } if ( $ this -> service !== null ) { throw new \ RuntimeException ( 'Service already started.' ) ; } $ serviceAddress = $ this -> getServiceAddress ( ) ; $ factor...
Start the Service .
57,072
public function run ( ) { pcntl_signal_dispatch ( ) ; if ( $ this -> service == null || ! $ this -> service -> isAlive ( ) ) { throw new \ RuntimeException ( 'Service not running.' ) ; } $ workerHandlerSocket = $ this -> socketFactory -> createRequest ( Factory :: MODE_CONNECT , $ this -> workerHandlerAddress ) ; $ ser...
Run the worker .
57,073
public function stop ( $ signal = null ) { if ( ! $ this -> running ) { return ; } if ( null !== $ signal ) { $ this -> getLogger ( ) -> info ( 'Stop called because of signal #' . $ signal . '. Current state: ' . $ this -> worker -> getState ( ) . '.' ) ; } else { $ this -> getLogger ( ) -> info ( 'Stop called: ' . $ t...
Stops this Worker .
57,074
public function index ( array $ input = array ( ) , $ category = null ) { $ query = e ( array_get ( $ input , 'search.value' , null ) ) ; if ( ! is_null ( $ category ) ) { return $ this -> category ( $ query , $ category ) ; } $ this -> breadcrumb -> onIndex ( ) ; $ datatables = config ( 'search.datatables' ) ; $ tabs ...
Default index action
57,075
public function onTemplateCreated ( TemplateEvent $ event ) { $ template = $ event -> getTemplate ( ) ; $ zones = $ template -> getZones ( ) ; foreach ( $ template -> getTemplateType ( ) -> getZoneTypes ( ) as $ zoneType ) { if ( $ zones -> search ( array ( 'zoneType' => $ zoneType ) ) -> isEmpty ( ) ) { if ( null === ...
Template creation event handler .
57,076
static protected function createException ( $ value , $ message , $ code , $ propertyPath , array $ constraints = array ( ) ) { $ constraintString = 'Constraints: ' ; if ( count ( $ constraints ) ) { foreach ( $ constraints as $ key => $ v ) { $ constraintString .= "$key => $v, " ; } $ constraintString = substr ( $ $ c...
Helper method that handles building the assertion failure exceptions . They are returned from this method so that the stack trace still shows the assertions method .
57,077
static public function integer ( $ value , $ message = null , $ propertyPath = null ) { if ( ! is_int ( $ value ) ) { $ message = $ message ? : sprintf ( 'Value "%s" is not an integer.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: INVALID_INTEGER , $ propertyPa...
Assert that value is a php integer .
57,078
static public function float ( $ value , $ message = null , $ propertyPath = null ) { if ( ! is_float ( $ value ) ) { $ message = $ message ? : sprintf ( 'Value "%s" is not a float.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: INVALID_FLOAT , $ propertyPath ) ...
Assert that value is a php float .
57,079
static public function digit ( $ value , $ message = null , $ propertyPath = null ) { if ( ! ctype_digit ( ( string ) $ value ) ) { $ message = $ message ? : sprintf ( 'Value "%s" is not a digit.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: INVALID_DIGIT , $ p...
Validates if an integer or integerish is a digit .
57,080
static public function integerish ( $ value , $ message = null , $ propertyPath = null ) { if ( strval ( intval ( $ value ) ) != $ value || is_bool ( $ value ) || is_null ( $ value ) ) { $ message = $ message ? : sprintf ( 'Value "%s" is not an integer or a number castable to integer.' , static :: stringify ( $ value )...
Assert that value is a php integer ish .
57,081
static public function boolean ( $ value , $ message = null , $ propertyPath = null ) { if ( ! is_bool ( $ value ) ) { $ message = $ message ? : sprintf ( 'Value "%s" is not a boolean.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: INVALID_BOOLEAN , $ propertyPa...
Assert that value is php boolean
57,082
static public function notEmpty ( $ value , $ message = null , $ propertyPath = null ) { if ( empty ( $ value ) ) { $ message = $ message ? : sprintf ( 'Value "%s" is empty, but non empty value was expected.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: VALUE_E...
Assert that value is not empty
57,083
static public function noContent ( $ value , $ message = null , $ propertyPath = null ) { if ( ! empty ( $ value ) ) { $ message = $ message ? : sprintf ( 'Value "%s" is not empty, but empty value was expected.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: VALU...
Assert that value is empty
57,084
static public function notNull ( $ value , $ message = null , $ propertyPath = null ) { if ( $ value === null ) { $ message = $ message ? : sprintf ( 'Value "%s" is null, but non null value was expected.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: VALUE_NULL ...
Assert that value is not null
57,085
static public function string ( $ value , $ message = null , $ propertyPath = null ) { if ( ! is_string ( $ value ) ) { $ message = $ message ? : sprintf ( 'Value "%s" expected to be string, type %s given.' , static :: stringify ( $ value ) , gettype ( $ value ) ) ; throw static :: createException ( $ value , $ message...
Assert that value is a string
57,086
static public function regex ( $ value , $ pattern , $ message = null , $ propertyPath = null ) { static :: string ( $ value , $ message ) ; if ( ! preg_match ( $ pattern , $ value ) ) { $ message = $ message ? : sprintf ( 'Value "%s" does not match expression.' , static :: stringify ( $ value ) ) ; throw static :: cre...
Assert that value matches a regex
57,087
static public function length ( $ value , $ length , $ message = null , $ propertyPath = null , $ encoding = 'utf8' ) { static :: string ( $ value , $ message ) ; if ( mb_strlen ( $ value , $ encoding ) !== $ length ) { $ message = $ message ? : sprintf ( 'Value "%s" has to be %d exactly characters long, but length is ...
Assert that string has a given length .
57,088
static public function betweenLength ( $ value , $ minLength , $ maxLength , $ message = null , $ propertyPath = null , $ encoding = 'utf8' ) { static :: string ( $ value , $ message ) ; if ( mb_strlen ( $ value , $ encoding ) < $ minLength ) { $ message = $ message ? : sprintf ( 'Value "%s" is too short, it should hav...
Assert that string length is between min max lengths .
57,089
static public function startsWith ( $ string , $ needle , $ message = null , $ propertyPath = null , $ encoding = 'utf8' ) { static :: string ( $ string ) ; if ( mb_strpos ( $ string , $ needle , null , $ encoding ) !== 0 ) { $ message = $ message ? : sprintf ( 'Value "%s" does not start with "%s".' , static :: stringi...
Assert that string starts with a sequence of chars .
57,090
static public function endsWith ( $ string , $ needle , $ message = null , $ propertyPath = null , $ encoding = 'utf8' ) { static :: string ( $ string ) ; $ stringPosition = mb_strlen ( $ string , $ encoding ) - mb_strlen ( $ needle , $ encoding ) ; if ( mb_strripos ( $ string , $ needle , null , $ encoding ) !== $ str...
Assert that string ends with a sequence of chars .
57,091
static public function contains ( $ string , $ needle , $ message = null , $ propertyPath = null , $ encoding = 'utf8' ) { static :: string ( $ string ) ; if ( mb_strpos ( $ string , $ needle , null , $ encoding ) === false ) { $ message = $ message ? : sprintf ( 'Value "%s" does not contain "%s".' , static :: stringif...
Assert that string contains a sequence of chars .
57,092
static public function choice ( $ value , array $ choices , $ message = null , $ propertyPath = null ) { if ( ! Arrays :: in ( $ value , $ choices , true ) ) { $ message = $ message ? : sprintf ( 'Value "%s" is not an element of the valid values: %s' , static :: stringify ( $ value ) , implode ( ", " , array_map ( 'Ass...
Assert that value is in array of choices .
57,093
static public function numeric ( $ value , $ message = null , $ propertyPath = null ) { if ( ! is_numeric ( $ value ) ) { $ message = $ message ? : sprintf ( 'Value "%s" is not numeric.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: INVALID_NUMERIC , $ propertyP...
Assert that value is numeric .
57,094
static public function isArray ( $ value , $ message = null , $ propertyPath = null ) { if ( ! Arrays :: is ( $ value ) ) { $ message = $ message ? : sprintf ( 'Value "%s" is not an array.' , static :: stringify ( $ value ) ) ; throw static :: createException ( $ value , $ message , static :: INVALID_ARRAY , $ property...
Assert that value is array .
57,095
static public function keyExists ( $ value , $ key , $ message = null , $ propertyPath = null ) { static :: isArray ( $ value ) ; if ( ! Arrays :: exists ( $ key , $ value ) ) { $ message = $ message ? : sprintf ( 'Array does not contain an element with key "%s"' , static :: stringify ( $ key ) ) ; throw static :: crea...
Assert that key exists in array
57,096
static public function notEmptyKey ( $ value , $ key , $ message = null , $ propertyPath = null ) { static :: keyExists ( $ value , $ key , $ message , $ propertyPath ) ; static :: notEmpty ( $ value [ $ key ] , $ message , $ propertyPath ) ; }
Assert that key exists in array and it s value not empty .
57,097
static public function notBlank ( $ value , $ message = null , $ propertyPath = null ) { if ( false === $ value || ( empty ( $ value ) && '0' != $ value ) ) { $ message = $ message ? : sprintf ( 'Value "%s" is blank, but was expected to contain a value.' , static :: stringify ( $ value ) ) ; throw static :: createExcep...
Assert that value is not blank
57,098
static public function isInstanceOf ( $ value , $ className , $ message = null , $ propertyPath = null ) { if ( ! ( $ value instanceof $ className ) ) { $ message = $ message ? : sprintf ( 'Class "%s" was expected to be instanceof of "%s" but is not.' , static :: stringify ( $ value ) , $ className ) ; throw static :: ...
Assert that value is instance of given class - name .
57,099
static public function notIsInstanceOf ( $ value , $ className , $ message = null , $ propertyPath = null ) { if ( $ value instanceof $ className ) { $ message = $ message ? : sprintf ( 'Class "%s" was not expected to be instanceof of "%s".' , static :: stringify ( $ value ) , $ className ) ; throw static :: createExce...
Assert that value is not instance of given class - name .