idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
233,800
public function escapeCss ( $ string , $ encoding = 'utf-8' ) { $ current = Escape :: getEncoding ( ) ; Escape :: setEncoding ( $ encoding ) ; $ result = Escape :: css ( $ string ) ; Escape :: setEncoding ( $ current ) ; return $ result ; }
Escape a string for the CSS context .
233,801
protected function partial ( $ file ) { $ viewmodel = new ViewModel ( $ file ) ; $ viewmodel -> assign ( $ this -> viewmodel -> getVariables ( ) ) ; ViewContainer :: output ( $ viewmodel ) ; }
Calls the parse function
233,802
protected function form ( $ type , $ name = null , $ value = null ) { $ form = new Form ( ) ; return $ form -> { $ type } ( $ name , $ value ) ; }
Calls the url function of the sFire \ Routing \ Router
233,803
protected function translate ( $ key , $ params = null , $ language = null ) { return Translation :: translate ( $ key , $ params , $ language , $ this -> getViewmodel ( ) ) ; }
Calls the translate function of the sFire \ Translation \ Translate
233,804
protected function template ( $ action , $ params = null ) { if ( false === is_string ( $ action ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ action ) ) , E_USER_ERROR ) ; } if ( null !== $ params && false === is_array ( $ params ) ...
Execute user defined template function
233,805
public function getPolicy ( Role $ role , string $ action ) { $ rules = $ this -> getRules ( ) ; $ pref_policy = $ this -> getACL ( ) -> getPreferredPolicy ( ) ; $ inherit = true ; $ ancestor_distance = null ; $ ancestor_policy = null ; foreach ( $ rules as $ rule ) { if ( $ rule -> policy === Rule :: NOINHERIT ) { $ i...
Find the policy to the Role performing the action on this Entity .
233,806
public function setUp ( array $ params ) { if ( empty ( $ params [ 'endpoint' ] ) ) { throw new \ RuntimeException ( 'Parameter "endpoint" cannot be empty.' ) ; } if ( empty ( $ params [ 'ssl_pem_path' ] ) ) { throw new \ RuntimeException ( 'Parameter "ssl_pem_path" cannot be empty.' ) ; } if ( ! is_readable ( $ params...
Set up parameters .
233,807
private function getStreamSocketClient ( ) { $ stream_socket_client = stream_socket_client ( $ this -> params [ 'endpoint' ] , $ errno , $ errstr , 30 , STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT , $ this -> getStreamContext ( ) ) ; if ( $ stream_socket_client === false ) { throw new PushException ( 'An error occ...
Get the Stream socket client .
233,808
private function getStreamContext ( ) { $ context = array ( 'ssl' => array ( 'local_cert' => $ this -> params [ 'ssl_pem_path' ] , ) , ) ; if ( ! empty ( $ this -> params [ 'ssl_passphrase' ] ) ) { $ context [ 'ssl' ] [ 'passphrase' ] = $ this -> params [ 'ssl_passphrase' ] ; } return stream_context_create ( $ context ...
Get secured stream context from SSL certificate .
233,809
public function hiddenFormFields ( ) { $ fields = $ this -> getParameter ( 'fields' ) ; if ( empty ( $ fields ) ) return '' ; $ html_array = ArrayUtils :: htmlArrayFlatten ( $ fields ) ; foreach ( $ html_array as $ name => $ value ) { $ name = htmlentities ( $ name , ENT_QUOTES ) ; $ value = htmlentities ( $ value , EN...
Returns all the fields passed into fields as hidden fields to submit
233,810
public function protocol ( $ version = false ) : string { if ( $ version === false ) { $ protocol = 'http' ; if ( $ this -> server ( ) -> get ( 'HTTPS' ) ) { $ protocol = 'https' ; } return $ protocol ; } return $ this -> server ( ) -> get ( 'SERVER_PROTOCOL' ) ; }
Get used server protocal
233,811
public function incoming ( Application $ app ) { $ route = $ app -> getService ( 'router' ) -> findHttpRoute ( $ this ) ; if ( ! empty ( $ route -> offsetGet ( 'action' ) ) ) { $ app :: getContainer ( ) -> offsetSet ( 'callback' , $ route ) ; return ; } $ app -> setActiveUnit ( Application :: APPLICATION_UNIT_NAMESPACE...
Initialize incoming request Determine if route contains callback or service execution
233,812
private function buildProcess ( string $ process , string $ fullServiceName ) { $ methods = array_flip ( get_class_methods ( $ fullServiceName ) ) ; if ( ! array_key_exists ( ( $ process ) , $ methods ) ) { throw new \ Nuki \ Exceptions \ Base ( 'No available process is found for the provided service' ) ; } return $ pr...
Build process name
233,813
public function triggerGroup ( ? array $ events = [ ] , ? array $ args = null ) { foreach ( $ events as $ callback ) { if ( is_callable ( $ callback ) ) { call_user_func_array ( $ callback , isset ( $ args ) ? $ args : [ ] ) ; } else if ( is_string ( $ callback ) ) { $ call = new $ callback ; call_user_func_array ( [ $...
Trigger a grouped event
233,814
public function cmdGetCity ( ) { $ result = $ this -> getListCity ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableCity ( $ result ) ; $ this -> output ( ) ; }
Callback for city - get command
233,815
public function cmdDeleteCity ( ) { $ id = $ this -> getParam ( 0 ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ options = null ; if ( $ this -> getParam ( 'state' ) ) { $ options = array ( 'state_id' => $ id ) ; } else if ( $ this -> getParam ( 'country' ) ) { $ opti...
Callback for city - delete command
233,816
public function cmdUpdateCity ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this -> ...
Callback for city - update command
233,817
protected function getListCity ( ) { $ id = $ this -> getParam ( 0 ) ; if ( ! isset ( $ id ) ) { return $ this -> city -> getList ( array ( 'limit' => $ this -> getLimit ( ) ) ) ; } if ( $ this -> getParam ( 'state' ) ) { return $ this -> city -> getList ( array ( 'state_id' => $ id , 'limit' => $ this -> getLimit ( ) ...
Returns an array of cities
233,818
protected function addCity ( ) { if ( ! $ this -> isError ( ) ) { $ id = $ this -> city -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ id ) ; } }
Add a new city
233,819
protected function submitAddCity ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'city' ) ; $ this -> addCity ( ) ; }
Add a new city at once
233,820
protected function wizardAddCity ( ) { $ this -> validatePrompt ( 'name' , $ this -> text ( 'Name' ) , 'city' ) ; $ this -> validatePrompt ( 'state_id' , $ this -> text ( 'Country state' ) , 'city' ) ; $ this -> validatePrompt ( 'country' , $ this -> text ( 'Country' ) , 'city' ) ; $ this -> validatePrompt ( 'zone_id' ...
Add a new city step by step
233,821
public static function commit ( $ protocol ) { if ( isset ( self :: $ _partitions [ $ protocol ] ) ) { $ partition = self :: $ _partitions [ $ protocol ] ; $ partition -> commit ( ) ; $ result = true ; } else { $ result = false ; } return $ result ; }
Commit all changes to real FS
233,822
protected static function getPartition ( $ url ) { $ urlParts = explode ( "://" , $ url ) ; $ protocol = array_shift ( $ urlParts ) ; return self :: $ _partitions [ $ protocol ] ; }
Return partition by file url
233,823
public static function getRelativePath ( $ url ) { $ urlParts = explode ( "://" , $ url ) ; array_shift ( $ urlParts ) ; $ urlPath = implode ( "://" , $ urlParts ) ; return Entity :: fixPath ( $ urlPath ) ; }
Return urlPath of url
233,824
public function create ( $ options = [ ] ) { $ capsule = $ this -> _database -> getCapsule ( ) ; if ( empty ( $ options ) || ! is_array ( $ options ) ) { throw new \ Exception ( 'Create options must not be empty and must be an instance of an array!' ) ; } $ this -> filter ( $ options ) ; $ options [ 'created_at' ] = da...
Creates a new table row .
233,825
public function find ( $ id ) { $ capsule = $ this -> _database -> getCapsule ( ) ; $ this -> _model = $ capsule -> table ( $ this -> table ) -> where ( 'id' , '=' , $ id ) ; return $ this -> _model -> first ( ) ; }
Finds an item by it s id .
233,826
public function where ( $ column , $ operator , $ value ) { $ capsule = $ this -> _database -> getCapsule ( ) ; if ( empty ( $ column ) ) { throw new \ Exception ( 'You must provide the column to look up!' ) ; } if ( empty ( $ operator ) ) { throw new \ Exception ( 'You must provide an operator!' ) ; } if ( empty ( $ v...
Searches for something in the database .
233,827
public function count ( ) { if ( is_array ( $ this -> _model ) ) { return count ( $ this -> _model ) ; } else { return $ this -> _model -> count ( ) ; } }
Gets the number of results .
233,828
public function all ( $ order = 'ASC' ) { $ capsule = $ this -> _database -> getCapsule ( ) ; $ this -> _model = $ capsule -> table ( $ this -> table ) -> orderBy ( 'id' , $ order ) -> get ( ) ; return $ this -> _model ; }
Gets all results from the database .
233,829
public function select ( $ capsule = null , $ limit = null , $ offset = null , $ columns = [ ] ) { if ( is_null ( $ capsule ) ) { $ capsule = $ this -> _database -> getCapsule ( ) -> table ( $ this -> table ) ; } if ( empty ( $ columns ) ) { $ columns = '*' ; } else { $ cstring = '' ; foreach ( $ columns as $ column ) ...
Selects from the database table via custom SQL command .
233,830
public function paginate ( $ limit ) { $ capsule = $ this -> _database -> getCapsule ( ) ; $ this -> _model = $ capsule -> table ( $ this -> table ) ; $ paginator = new Pagination ( ) ; $ paginator -> setLimit ( $ limit ) -> setModel ( $ this , $ this -> _model ) ; return $ paginator -> paginate ( ) ; }
Does like all but creates pagination for results .
233,831
public function save ( $ options ) { $ gcc = get_called_class ( ) ; $ class = $ gcc :: init ( ) ; $ cap = $ this -> _database -> getCapsule ( ) ; $ params = ( array ) $ options ; $ this -> filter ( $ params ) ; return $ cap -> table ( $ this -> table ) -> update ( $ params ) ; }
Saves changes to a model .
233,832
private function filter ( & $ options ) { foreach ( $ options as $ key => $ value ) { if ( ! in_array ( $ key , $ this -> fillable ) ) { unset ( $ options [ $ key ] ) ; } } }
Filters out options that are not included in a model s fillable array .
233,833
protected function parseResourceSignature ( ) { list ( $ topic , $ actionAndFormat ) = explode ( '/' , $ this -> signature ) ; list ( $ action , $ format ) = explode ( '.' , $ actionAndFormat ) ; $ this -> topic = ucfirst ( $ topic ) ; $ this -> action = ucfirst ( $ action ) ; $ this -> format = $ format ; }
parses a resource signature
233,834
protected function initializeConcreteResource ( ) { $ this -> concreteResource = $ this -> resourceResolver -> resolve ( $ this -> topic , $ this -> action ) ; }
initializes a concrete resource implementation
233,835
public function restore ( ) { $ this -> offsetRef = $ this -> offset ; $ this -> lineRef = $ this -> line ; $ this -> rowRef = $ this -> row ; }
Restores the source to which this state belongs to this state .
233,836
public static function replace ( array $ words , $ replacement , $ text ) { $ self = new self ; $ length = $ self -> wordsLength ( $ words ) ; $ blocks = array_unique ( $ length ) ; $ min = end ( $ blocks ) ; $ chars = $ self -> splitText ( $ text ) ; $ index = $ self -> index ( $ chars ) ; $ pinyins = $ self -> pinyin...
Replace words with replacements in a text .
233,837
protected function wordsLength ( array $ words ) { $ length = [ ] ; foreach ( $ words as $ word ) { $ pinyin = $ this -> pinyin -> sentence ( $ word ) ; $ length [ md5 ( $ pinyin ) ] = ( $ pinyin === $ word ) ? 1 : mb_strlen ( $ word ) ; } arsort ( $ length ) ; return $ length ; }
Get echo word length and use md5 as key .
233,838
protected function splitText ( $ text ) { $ punctuations = preg_quote ( implode ( '' , $ this -> punctuations ) , '/' ) ; $ text = preg_replace ( '/([^\p{Han}\s' . $ punctuations . ']+)/u' , "\t\t\t$1\t\t" , $ text ) ; $ array = [ ] ; foreach ( preg_split ( '/\t\t/u' , $ text , - 1 , PREG_SPLIT_NO_EMPTY ) as $ item ) {...
Spilt text to array .
233,839
protected function index ( array $ chars ) { $ index = [ ] ; foreach ( $ chars as $ key => $ char ) { if ( preg_match ( '/[\p{Han}\w]+/u' , $ char ) ) { $ index [ ] = $ key ; } } return $ index ; }
Build words index .
233,840
public function setData ( array $ data = [ ] ) { $ this -> default = empty ( $ data ) ; $ this -> data = array_replace ( [ static :: VISIBLE_COLUMNS => [ ] , static :: MAX_PER_PAGE => null , static :: CONFIG => null , static :: PAGE_NUM => null , static :: SORT => null , static :: ADD_FILTER => null , static :: REMOVE_...
Sets the data .
233,841
public function getSortHref ( ColumnInterface $ column ) { $ parameter = $ this -> getSortName ( ) ; $ dir = ( $ column -> getSortDirection ( ) === ColumnSort :: ASC ? ColumnSort :: DESC : ColumnSort :: ASC ) ; return '?' . $ parameter . '[by]=' . $ column -> getName ( ) . '&' . $ parameter . '[dir]=' . $ dir ; }
Returns the sort column href .
233,842
public function getIdentifiersName ( ) { $ name = $ this -> tableName . '[' . static :: IDENTIFIERS . ']' ; if ( $ this -> selectionMode == Config :: SELECTION_MULTIPLE ) { $ name .= '[]' ; } return $ name ; }
Returns the identifiers parameter name .
233,843
private function getProfileValue ( $ name ) { if ( isset ( $ this -> data [ static :: PROFILE ] [ $ name ] ) ) { return $ this -> data [ static :: PROFILE ] [ $ name ] ; } return null ; }
Returns the profile parameter value .
233,844
public function offsetExists ( $ key ) { if ( is_numeric ( $ key ) ) { throw new InvalidArgumentException ( 'Entity array access only supports non-numeric keys' ) ; } if ( $ this -> separator && strstr ( $ key , $ this -> separator ) ) { return $ this -> hasWithSeparator ( $ key ) ; } $ key = $ this -> camelize ( $ key...
Determines if this store contains the specified key and if its value is not NULL .
233,845
public function offsetReplace ( $ key , $ value ) { if ( is_numeric ( $ key ) ) { throw new InvalidArgumentException ( 'Entity array access only supports non-numeric keys' ) ; } $ key = $ this -> camelize ( $ key ) ; if ( $ key === '' ) { return ; } if ( is_array ( $ value ) && isset ( $ this [ $ key ] ) ) { $ data = $...
Replaces the value from the specified key .
233,846
public function addFile ( $ path ) { $ config = $ this -> loadFile ( $ path ) ; if ( is_array ( $ config ) ) { $ this -> merge ( $ config ) ; } return $ this ; }
Adds a configuration file to the configset .
233,847
public static function ltrim ( $ docComment ) { $ regexp = array ( '|^[\s\t]*(/\*\*)|um' => '\\1' , '|^[\s\t]*([ ]\*/)|um' => '\\1' , '|^[\s\t]*([ ]\*[ ]*)|um' => '\\1' , ) ; $ patterns = array_keys ( $ regexp ) ; $ replacements = array_values ( $ regexp ) ; $ docComment = preg_replace ( $ patterns , $ replacements , $...
Trim spaces and tabs on the left
233,848
public function renderColumnBody ( ColumnView $ view , array $ variables = array ( ) ) { return $ this -> render ( $ view , 'column_' . $ view -> get ( 'type' ) , $ variables ) ; }
Renders column body .
233,849
protected function getBlocks ( DataGridView $ view ) { if ( ! $ this -> blocks -> contains ( $ view ) ) { $ templates = $ this -> resources ; if ( isset ( $ this -> themes [ $ view ] ) ) { $ templates = array_merge ( $ templates , $ this -> themes [ $ view ] ) ; } $ blocks = array ( ) ; foreach ( $ templates as $ templ...
Returns the blocks used to render the view .
233,850
public function getShippingContactDifferences ( $ mode = self :: MODE_FILTER_EMPTY_WHEN_STRING_VALUES ) { $ difference = [ ] ; foreach ( $ this -> getContactParameterNames ( ) as $ parameterName ) { $ billingGetter = 'getBilling' . ucfirst ( $ parameterName ) ; $ shippingGetter = 'getShipping' . ucfirst ( $ parameterNa...
Returns those shipping contact parameters which are different for shipping and billing Keys are camel cased parameter names without shipping prefix values are shipping contact parameter values
233,851
public function chain ( $ item = null ) { list ( $ item ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; $ __ = ( isset ( $ this ) && isset ( $ this -> _chained ) && $ this -> _chained ) ? $ this : __ ( $ item ) ; $ __ -> _chained = true ; return $ __ ; }
Are we in a chain?
233,852
public function each ( $ collection = null , $ iterator = null ) { list ( $ collection , $ iterator ) = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; if ( is_null ( $ collection ) ) return self :: _wrap ( null ) ; $ collection = ( array ) self :: _collection ( $ collection ) ; if ( count ( $ collection ) === 0 ) return...
Invoke the iterator on each item in the collection
233,853
public function invoke ( $ collection = null , $ function_name = null , $ arguments = null ) { $ args = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; $ __ = new self ; list ( $ collection , $ function_name ) = $ __ -> first ( $ args , 2 ) ; $ arguments = $ __ -> rest ( func_get_args ( ) , 2 ) ; $ is_obj = is_object ( $...
Invoke the named function over each item in the collection optionally passing arguments to the function
233,854
public function size ( $ collection = null ) { list ( $ collection ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; $ collection = self :: _collection ( $ collection ) ; return self :: _wrap ( count ( ( array ) $ collection ) ) ; }
How many items are in this collection?
233,855
public function initial ( $ collection = null , $ n = null ) { list ( $ collection , $ n ) = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; $ collection = ( array ) self :: _collection ( $ collection ) ; if ( is_null ( $ n ) ) $ n = 1 ; $ first_index = count ( $ collection ) - $ n ; $ __ = new self ; return self :: _wra...
Return everything but the last array element . Passing n excludes the last n elements .
233,856
public function compact ( $ collection = null ) { list ( $ collection ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; $ collection = self :: _collection ( $ collection ) ; $ __ = new self ; return self :: _wrap ( $ __ -> select ( $ collection , function ( $ val ) { return ( bool ) $ val ; } ) ) ; }
Return a copy of the array with falsy values removed
233,857
public function flatten ( $ collection = null , $ shallow = null ) { list ( $ collection , $ shallow ) = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; $ collection = self :: _collection ( $ collection ) ; $ return = array ( ) ; if ( count ( $ collection ) > 0 ) { foreach ( $ collection as $ item ) { if ( is_array ( $ i...
Flattens a multidimensional array
233,858
public function without ( $ collection = null , $ val = null ) { $ args = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; $ collection = $ args [ 0 ] ; $ collection = self :: _collection ( $ collection ) ; $ num_args = count ( $ args ) ; if ( $ num_args === 1 ) return self :: _wrap ( $ collection ) ; if ( count ( $ colle...
Returns a copy of the array with all instances of val removed
233,859
public function intersection ( $ array = null ) { $ arrays = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; if ( count ( $ arrays ) === 1 ) return self :: _wrap ( $ array ) ; $ __ = new self ; $ return = $ __ -> first ( $ arrays ) ; foreach ( $ __ -> rest ( $ arrays ) as $ next ) { if ( ! $ __ -> isArray ( $ next ) ) $ ...
Returns an array containing the intersection of all the arrays
233,860
public function union ( $ array = null ) { $ arrays = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; if ( count ( $ arrays ) === 1 ) return self :: _wrap ( $ array ) ; $ __ = new self ; return self :: _wrap ( $ __ -> flatten ( array_values ( array_unique ( call_user_func_array ( 'array_merge' , $ arrays ) ) ) ) ) ; }
Merge together multiple arrays
233,861
public function difference ( $ array_one = null , $ array_two = null ) { $ arrays = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; return self :: _wrap ( array_values ( call_user_func_array ( 'array_diff' , $ arrays ) ) ) ; }
Get the difference between two arrays
233,862
public function indexOf ( $ collection = null , $ item = null ) { list ( $ collection , $ item ) = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; $ collection = self :: _collection ( $ collection ) ; $ key = array_search ( $ item , $ collection , true ) ; return self :: _wrap ( ( is_bool ( $ key ) ) ? - 1 : $ key ) ; }
Get the index of the first match
233,863
public function lastIndexOf ( $ collection = null , $ item = null ) { list ( $ collection , $ item ) = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; $ collection = self :: _collection ( $ collection ) ; krsort ( $ collection ) ; $ __ = new self ; return self :: _wrap ( $ __ -> indexOf ( $ collection , $ item ) ) ; }
Get the index of the last match
233,864
public function max ( $ collection = null , $ iterator = null ) { list ( $ collection , $ iterator ) = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; if ( is_null ( $ iterator ) ) return self :: _wrap ( max ( $ collection ) ) ; $ results = array ( ) ; foreach ( $ collection as $ k => $ item ) { $ results [ $ k ] = $ ite...
Get the max value in the collection
233,865
public function sortedIndex ( $ collection = null , $ value = null , $ iterator = null ) { list ( $ collection , $ value , $ iterator ) = self :: _wrapArgs ( func_get_args ( ) , 3 ) ; $ collection = ( array ) self :: _collection ( $ collection ) ; $ __ = new self ; $ calculated_value = ( ! is_null ( $ iterator ) ) ? $ ...
Returns the index at which the value should be inserted into the sorted collection
233,866
public function shuffle ( $ collection = null ) { list ( $ collection ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; $ collection = ( array ) self :: _collection ( $ collection ) ; shuffle ( $ collection ) ; return self :: _wrap ( $ collection ) ; }
Shuffle the array
233,867
public function keys ( $ collection = null ) { list ( $ collection ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; if ( ! is_object ( $ collection ) && ! is_array ( $ collection ) ) throw new Exception ( 'Invalid object' ) ; return self :: _wrap ( array_keys ( ( array ) $ collection ) ) ; }
Get the collection s keys
233,868
public function values ( $ collection = null ) { list ( $ collection ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; return self :: _wrap ( array_values ( ( array ) $ collection ) ) ; }
Get the collection s values
233,869
public function extend ( $ object = null ) { $ args = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; $ num_args = func_num_args ( ) ; if ( $ num_args === 1 ) return $ object ; $ is_object = is_object ( $ object ) ; $ array = ( array ) $ object ; $ __ = new self ; $ extensions = $ __ -> rest ( func_get_args ( ) ) ; forea...
Copy all properties from the source objects into the destination object
233,870
public function defaults ( $ object = null ) { $ args = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; list ( $ object ) = $ args ; $ num_args = count ( $ args ) ; if ( $ num_args === 1 ) return $ object ; $ is_object = is_object ( $ object ) ; $ array = ( array ) $ object ; $ __ = new self ; $ extensions = $ __ -> rest...
Returns the object with any missing values filled in using the defaults .
233,871
public function clon ( & $ object = null ) { list ( $ object ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; $ clone = null ; if ( is_array ( $ object ) ) $ clone = ( array ) clone ( object ) $ object ; elseif ( ! is_object ( $ object ) ) $ clone = $ object ; elseif ( ! $ clone ) $ clone = clone $ object ; if ( is_ob...
Returns a shallow copy of the object
233,872
public function tap ( $ object = null , $ interceptor = null ) { list ( $ object , $ interceptor ) = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; $ interceptor ( $ object ) ; return self :: _wrap ( $ object ) ; }
Invokes the interceptor on the object then returns the object
233,873
public function has ( $ collection = null , $ key = null ) { list ( $ collection , $ key ) = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; $ collection = ( array ) self :: _collection ( $ collection ) ; return self :: _wrap ( array_key_exists ( $ key , $ collection ) ) ; }
Does the given key exist?
233,874
public function isEqual ( $ a = null , $ b = null ) { list ( $ a , $ b ) = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; if ( isset ( $ this ) && isset ( $ this -> _chained ) && $ this -> _chained ) $ a = & $ this ; if ( $ a === $ b ) return self :: _wrap ( true ) ; if ( gettype ( $ a ) !== gettype ( $ b ) ) return sel...
Are these items equal?
233,875
public function isEmpty ( $ item = null ) { list ( $ item ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; return self :: _wrap ( is_array ( $ item ) || is_object ( $ item ) ) ? ! ( ( bool ) count ( ( array ) $ item ) ) : ( ! ( bool ) $ item ) ; }
Is this item empty?
233,876
public function isObject ( $ item = null ) { list ( $ item ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; return self :: _wrap ( is_object ( $ item ) ) ; }
Is this item an object?
233,877
public function isArray ( $ item = null ) { list ( $ item ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; return self :: _wrap ( is_array ( $ item ) ) ; }
Is this item an array?
233,878
public function isString ( $ item = null ) { list ( $ item ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; return self :: _wrap ( is_string ( $ item ) ) ; }
Is this item a string?
233,879
public function isNumber ( $ item = null ) { list ( $ item ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; return self :: _wrap ( ( is_int ( $ item ) || is_float ( $ item ) ) && ! is_nan ( $ item ) && ! is_infinite ( $ item ) ) ; }
Is this item a number?
233,880
public function isBoolean ( $ item = null ) { list ( $ item ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; return self :: _wrap ( is_bool ( $ item ) ) ; }
Is this item a bool?
233,881
public function isDate ( $ item = null ) { list ( $ item ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; return self :: _wrap ( is_object ( $ item ) && get_class ( $ item ) === 'DateTime' ) ; }
Is this item an instance of DateTime?
233,882
public function isNaN ( $ item = null ) { list ( $ item ) = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; return self :: _wrap ( is_nan ( $ item ) ) ; }
Is this item a NaN value?
233,883
public function identity ( ) { $ args = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; if ( is_array ( $ args ) ) return self :: _wrap ( $ args [ 0 ] ) ; return self :: _wrap ( function ( $ x ) { return $ x ; } ) ; }
Returns the same value passed as the argument
233,884
public function times ( $ n = null , $ iterator = null ) { list ( $ n , $ iterator ) = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; if ( is_null ( $ n ) ) $ n = 0 ; for ( $ i = 0 ; $ i < $ n ; $ i ++ ) $ iterator ( $ i ) ; return self :: _wrap ( null ) ; }
Invokes the iterator n times
233,885
public function templateSettings ( $ settings = null ) { $ _template_settings = & self :: getInstance ( ) -> _template_settings ; if ( is_null ( $ settings ) ) { $ _template_settings = array ( 'evaluate' => self :: TEMPLATE_DEFAULT_EVALUATE , 'interpolate' => self :: TEMPLATE_DEFAULT_INTERPOLATE , 'escape' => self :: T...
Set template settings
233,886
public function template ( $ code = null , $ context = null ) { list ( $ code , $ context ) = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; $ class_name = __CLASS__ ; $ return = self :: _wrap ( function ( $ context = null ) use ( $ code , $ class_name ) { $ ts = $ class_name :: getInstance ( ) -> _template_settings ; e...
Compile templates into functions that can be evaluated for rendering
233,887
public function wrap ( $ function = null , $ wrapper = null ) { list ( $ function , $ wrapper ) = self :: _wrapArgs ( func_get_args ( ) , 2 ) ; return self :: _wrap ( function ( ) use ( $ wrapper , $ function ) { $ args = array_merge ( array ( $ function ) , func_get_args ( ) ) ; return call_user_func_array ( $ wrapper...
Wraps the function inside the wrapper function passing it as the first argument
233,888
public function compose ( ) { $ functions = self :: _wrapArgs ( func_get_args ( ) , 1 ) ; return self :: _wrap ( function ( ) use ( $ functions ) { $ args = func_get_args ( ) ; foreach ( $ functions as $ function ) { $ args [ 0 ] = call_user_func_array ( $ function , $ args ) ; } return $ args [ 0 ] ; } ) ; }
Returns the composition of the functions
233,889
private function _wrap ( $ val ) { if ( isset ( $ this ) && isset ( $ this -> _chained ) && $ this -> _chained ) { $ this -> _wrapped = $ val ; return $ this ; } return $ val ; }
Value passed from one chained method to the next
233,890
private function _wrapArgs ( $ caller_args , $ num_args = null ) { $ num_args = ( is_null ( $ num_args ) ) ? count ( $ caller_args ) - 1 : $ num_args ; $ filled_args = array ( ) ; if ( isset ( $ this ) && isset ( $ this -> _wrapped ) ) { $ filled_args [ ] = & $ this -> _wrapped ; } if ( count ( $ caller_args ) > 0 ) { ...
because this function understands both OO - style and functional calls
233,891
private function _collection ( $ collection ) { return ( ! is_array ( $ collection ) && ! is_object ( $ collection ) ) ? str_split ( ( string ) $ collection ) : $ collection ; }
Get a collection in a way that supports strings
233,892
public function hasFlag ( $ flag ) { if ( ! is_string ( $ flag ) ) { throw new \ Console \ Exception \ InvalidArgument ( 'Parameter must be string.' ) ; } return in_array ( $ flag , $ this -> _flags ) ; }
Check if flag exists
233,893
public function hasOption ( $ option ) { if ( ! is_string ( $ option ) ) { throw new \ Console \ Exception \ InvalidArgument ( 'Parameter must be string.' ) ; } return isset ( $ this -> _options [ $ option ] ) ; }
Check if option exists
233,894
public function hasOptions ( array $ options ) { $ all = true ; foreach ( $ options as $ option ) { if ( ! isset ( $ this -> _options [ $ option ] ) ) { $ all = false ; } } return $ all ; }
Check if multiple options are given in the command - line arguments
233,895
public function getOption ( $ option ) { return isset ( $ this -> _options [ $ option ] ) ? $ this -> _options [ $ option ] : null ; }
Get option value
233,896
protected function getUserAccountName ( NotificationInterface $ notification , $ keyInData = 'uid' ) { $ names = [ ] ; $ count = 0 ; if ( isset ( $ notification [ $ keyInData ] ) ) { $ uidList = $ notification [ $ keyInData ] ; $ count = count ( $ uidList ) ; if ( ! is_array ( $ uidList ) ) { $ uidList = [ $ uidList ] ...
Return user account name for given uid
233,897
protected function getTitleString ( $ titles , $ count ) { $ limit = $ this -> getLimit ( ) ; $ okCount = count ( $ titles ) ; $ missing = $ count - $ okCount ; $ andCount = max ( [ 0 , $ okCount - $ limit ] ) + $ missing ; if ( ! $ okCount ) { list ( $ singular , $ plural ) = $ this -> getTypeLabelVariations ( $ count...
Get title string
233,898
public function addFieldError ( $ failureCode , $ fieldResolved , $ fieldType , $ fieldTitle , $ value , $ defaultErrorMessage ) { $ this -> errors [ ] = new FieldValidationError ( $ failureCode , $ fieldResolved , $ fieldType , $ fieldTitle , $ value , $ defaultErrorMessage ) ; return $ this ; }
Adds an error that is associated with a form field .
233,899
public function addErrors ( array $ errors ) { foreach ( $ errors as $ error ) { if ( ! $ error instanceof ValidationError ) throw new Exception ( 'Error was not instance of ValidationError: ' . $ error ) ; if ( ! in_array ( $ error , $ this -> errors ) ) $ this -> errors [ ] = $ error ; } return $ this ; }
Adds more than one error to the collection of errors