idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
50,800 | protected function getShortName ( $ class , $ type ) { $ name = explode ( '\\' . $ type . '\\' , $ class , 2 ) [ 1 ] ; $ pos = strrpos ( $ name , '\\' ) ; $ pos = $ pos === false ? 0 : $ pos + 1 ; $ name [ $ pos ] = lcfirst ( $ name [ $ pos ] ) ; $ name = lcfirst ( $ name ) ; return $ name ; } | Return short name of class by specified type |
50,801 | protected function globByDirs ( array $ dirs , $ pattern ) { $ dirs = implode ( ',' , $ dirs ) ; $ pattern = '{' . $ dirs . '}' . $ pattern ; return glob ( $ pattern , GLOB_BRACE | GLOB_NOSORT ) ; } | Find files matching a pattern in specified directories |
50,802 | protected function setInstalledIds ( array $ pluginIds ) { $ app = $ this -> app -> getRecord ( ) ; $ app [ 'pluginIds' ] = array_filter ( $ pluginIds ) ; $ app -> save ( ) ; return $ this ; } | Stores installed plugin IDs |
50,803 | final protected function fclose ( ) { $ this -> _fhandle = null ; $ this -> flocked = false ; $ this -> use_include_path = false ; } | Closes file . Only resets class variables |
50,804 | public function filesize ( ) { if ( $ this -> use_include_path ) { return filesize ( stream_resolve_include_path ( $ this -> _fhandle ) ) ; } else { return filesize ( $ this -> _fhandle ) ; } } | Gets file size |
50,805 | public function fileinode ( ) { if ( $ this -> use_include_path ) { return fileinode ( stream_resolve_include_path ( $ this -> _fhandle ) ) ; } else { return fileinode ( $ this -> _fhandle ) ; } } | Gets file inode |
50,806 | public function fileatime ( ) { if ( $ this -> use_include_path ) { return fileatime ( stream_resolve_include_path ( $ this -> _fhandle ) ) ; } else { return fileatime ( $ this -> _fhandle ) ; } } | Gets last access time of file |
50,807 | public function filectime ( ) { if ( $ this -> use_include_path ) { return filectime ( stream_resolve_include_path ( $ this -> _fhandle ) ) ; } else { return filectime ( $ this -> _fhandle ) ; } } | Gets inode change time of file |
50,808 | public function filemtime ( ) { if ( $ this -> use_include_path ) { return filemtime ( stream_resolve_include_path ( $ this -> _fhandle ) ) ; } else { return filemtime ( $ this -> _fhandle ) ; } } | Gets file modification time |
50,809 | public function fileowner ( ) { if ( $ this -> use_include_path ) { return fileowner ( stream_resolve_include_path ( $ this -> _fhandle ) ) ; } else { return fileowner ( $ this -> _fhandle ) ; } } | Gets file owner |
50,810 | public function filegroup ( ) { if ( $ this -> use_include_path ) { return filegroup ( stream_resolve_include_path ( $ this -> _fhandle ) ) ; } else { return filegroup ( $ this -> _fhandle ) ; } } | Gets file group |
50,811 | public function fileperms ( ) { if ( $ this -> use_include_path ) { return fileperms ( stream_resolve_include_path ( $ this -> _fhandle ) ) ; } else { return fileperms ( $ this -> _fhandle ) ; } } | Gets file permissions |
50,812 | public function getTypeTitle ( ) { return isset ( self :: $ type_titles [ $ this -> type ] ) ? self :: $ type_titles [ $ this -> type ] : '' ; } | Get title for current type . |
50,813 | public function getParam ( string $ paramName ) { return $ this -> hasParam ( $ paramName ) ? $ this -> params [ $ paramName ] : null ; } | Get parameter from request |
50,814 | public function setParam ( string $ paramName , $ paramValue ) : HttpRequestContract { $ this -> params [ $ paramName ] = $ paramValue ; return $ this ; } | Set parameter in request |
50,815 | function setArray ( array $ options ) { foreach ( $ options as $ key => $ value ) { $ this -> set ( $ key , $ value ) ; } return $ this ; } | Multiple set options . |
50,816 | function run ( callable $ callback = null ) { if ( isset ( $ this -> res ) ) return null ; $ this -> res = proc_open ( $ this -> cmd , $ this -> descriptor_spec , $ this -> pipes , $ this -> cwd , $ this -> env ) ; if ( $ this -> res ) { $ this -> stdout = new TcpConnection ( $ this -> pipes [ 1 ] ) ; if ( is_callable ... | Execute command in a child process . |
50,817 | function send ( $ data , $ length = null ) { if ( ! isset ( $ this -> pipes [ 0 ] ) ) return 0 ; if ( ! isset ( $ length ) ) $ length = strlen ( $ data ) ; return intval ( fwrite ( $ this -> pipes [ 0 ] , $ data , $ length ) ) ; } | Write data to stdin pipe . |
50,818 | function close ( ) { if ( isset ( $ this -> res ) ) { $ this -> stdout -> close ( ) ; fclose ( $ this -> pipes [ 0 ] ) ; $ status = $ this -> status ( ) ; $ exit = $ status [ 'running' ] ? proc_close ( $ this -> res ) : $ status [ 'exitcode' ] ; unset ( $ this -> res , $ this -> pipes , $ this -> stdout ) ; return $ ex... | Terminate process . |
50,819 | public function validateAsArray ( $ bool = null ) { if ( false === is_bool ( $ bool ) && null !== $ bool ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type boolean, "%s" given' , __METHOD__ , gettype ( $ bool ) ) , E_USER_ERROR ) ; } if ( null === $ bool ) { $ bool = true ; } foreach ( ... | Set a rule that a field value must be an array and all array items will be validated individual |
50,820 | public function combine ( ) { $ fieldnames = func_get_args ( ) ; $ values = [ ] ; foreach ( $ fieldnames as $ fieldname ) { if ( false === is_string ( $ fieldname ) ) { return trigger_error ( sprintf ( 'All fieldnames used in "%s"() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ fieldname ) ) , E_US... | Combines multiple fields to be as one for validation |
50,821 | public function token ( ) { $ session = new Session ( ) ; $ name = $ this -> getValue ( '_token-name' ) ; $ value = $ this -> getValue ( '_token-value' ) ; if ( ( null !== $ name && null !== $ value && $ session -> pull ( [ '_token' , $ name ] ) !== $ value ) || null === $ name || null === $ value ) { $ instance = $ th... | Validates token from input |
50,822 | private function getMessageInstance ( ) { if ( null === $ this -> messageInstance ) { $ this -> messageInstance = Message :: Instance ( ) ; } return $ this -> messageInstance ; } | Returns the instance for custom messsages |
50,823 | private function isRequired ( $ field , $ value ) { if ( true === isset ( $ this -> required [ $ field ] ) ) { $ empty = true ; if ( true === is_array ( $ value ) ) { foreach ( $ value as $ val ) { if ( strlen ( trim ( $ val ) ) > 0 ) { $ empty = false ; } } } if ( true === is_string ( $ value ) && strlen ( trim ( $ va... | Evaluates if field value is required or not |
50,824 | private function isValidateArray ( $ field ) { if ( true === isset ( $ this -> validateAsArray [ $ field ] ) ) { return $ this -> validateAsArray [ $ field ] ; } return false ; } | Evaluates if field value should be validated as an array |
50,825 | private function getRuleClass ( $ rule ) { if ( false === is_string ( $ rule ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ rule ) ) , E_USER_ERROR ) ; } if ( true === isset ( $ this -> custom [ $ rule ] ) ) { return $ this -> custom ... | Returns the class of the rule |
50,826 | private function setErrorMessage ( $ rule , $ class ) { $ instance = $ this -> getMessageInstance ( ) ; $ message = $ instance :: getMessage ( $ rule -> field , $ rule -> rule ) ; $ message = null !== $ message ? $ message : $ class -> getMessage ( ) ; $ message = Translation :: translate ( $ message , $ rule -> parame... | Set the error message for particular rule |
50,827 | private function getValue ( $ field , $ prefix = null ) { foreach ( $ this -> combine as $ combine ) { if ( $ combine -> getName ( ) === $ field ) { return $ combine -> combine ( ) ; } } if ( null !== $ prefix ) { $ field = $ prefix . '[' . $ field . ']' ; } $ helper = new StringToArray ( ) ; $ data = $ helper -> execu... | Returns the value for a given field |
50,828 | public function resetParts ( array $ partNames = array ( ) ) { if ( empty ( $ partNames ) ) { $ partNames = array_keys ( $ this -> parts ) ; } foreach ( $ partNames as $ partName ) { $ this -> resetPart ( $ partName ) ; } return $ this ; } | Resets query parts . |
50,829 | public function resetPart ( $ partName ) { $ this -> parts [ $ partName ] = is_array ( $ this -> parts [ $ partName ] ) ? array ( ) : null ; return $ this ; } | Resets a query part . |
50,830 | public function select ( $ selects = array ( ) ) { $ this -> type = self :: SELECT ; if ( ! empty ( $ selects ) ) { $ this -> parts [ 'select' ] = array_merge ( $ this -> parts [ 'select' ] , ( array ) $ selects ) ; } return $ this ; } | Sets the select query mode . |
50,831 | public function insert ( $ insert ) { $ this -> type = self :: INSERT ; $ this -> from ( $ insert ) ; return $ this ; } | Sets the insert query mode for a specific table . |
50,832 | public function update ( $ update , $ alias = null ) { $ this -> type = self :: UPDATE ; $ this -> from ( $ update , $ alias ) ; return $ this ; } | Sets the update query mode for a specific table . |
50,833 | public function delete ( $ delete , $ alias = null ) { $ this -> type = self :: DELETE ; $ this -> from ( $ delete , $ alias ) ; return $ this ; } | Sets the delete query mode for a specific table . |
50,834 | public function innerJoin ( $ fromAlias , $ join , $ alias , $ condition = null ) { return $ this -> join ( $ fromAlias , 'inner' , $ join , $ alias , $ condition ) ; } | Adds an INNER JOIN clause to the query . |
50,835 | public function rightJoin ( $ fromAlias , $ join , $ alias , $ condition = null ) { return $ this -> join ( $ fromAlias , 'right' , $ join , $ alias , $ condition ) ; } | Adds a RIGHT JOIN clause to the query . |
50,836 | public function where ( $ expression , $ type = Expression \ Expression :: TYPE_AND ) { return $ this -> addExpression ( 'where' , $ type , $ expression ) ; } | Adds a WHERE clause to the query . |
50,837 | public function having ( $ expression , $ type = Expression \ Expression :: TYPE_AND ) { return $ this -> addExpression ( 'having' , $ type , $ expression ) ; } | Adds an HAVING clause to the query . |
50,838 | public function setParameters ( array $ parameters , array $ types = array ( ) ) { foreach ( $ parameters as $ parameter => $ value ) { if ( isset ( $ types [ $ parameter ] ) ) { $ this -> setParameter ( $ parameter , $ value , $ types [ $ parameter ] ) ; } else { $ this -> setParameter ( $ parameter , $ value ) ; } } ... | Sets query parameters . |
50,839 | public function createParameter ( $ value , $ type = null ) { if ( $ this -> mode === self :: MODE_POSITIONAL ) { return $ this -> createPositionalParameter ( $ value , $ type ) ; } return $ this -> createNamedParameter ( $ value , $ type ) ; } | Creates and sets a parameter . |
50,840 | public function createPositionalParameter ( $ value , $ type = null ) { $ this -> setParameter ( $ this -> parameterCounters [ 'positional' ] , $ value , $ type ) ; return '?' ; } | Creates and sets a positional parameter . |
50,841 | public function createNamedParameter ( $ value , $ type = null , $ placeholder = null ) { if ( $ placeholder === null ) { $ placeholder = ':fridge' ; } $ parameter = substr ( $ placeholder , 1 ) ; if ( ! isset ( $ this -> parameterCounters [ 'named' ] [ $ parameter ] ) ) { $ this -> parameterCounters [ 'named' ] [ $ pa... | Creates and sets a named parameter . |
50,842 | public function getParameterType ( $ identifier ) { return isset ( $ this -> parameterTypes [ $ identifier ] ) ? $ this -> parameterTypes [ $ identifier ] : null ; } | Gets a query parameter type . |
50,843 | public function getQuery ( ) { $ query = null ; switch ( $ this -> type ) { case self :: SELECT : $ query = $ this -> getSelectQuery ( ) ; break ; case self :: INSERT : $ query = $ this -> getInsertQuery ( ) ; break ; case self :: UPDATE : $ query = $ this -> getUpdateQuery ( ) ; break ; case self :: DELETE : $ query =... | Gets the generated query . |
50,844 | private function addExpression ( $ part , $ type , $ expression ) { if ( ! ( $ expression instanceof Expression \ Expression ) ) { $ expression = new Expression \ Expression ( $ type , ( array ) $ expression ) ; } if ( $ this -> parts [ $ part ] === null ) { $ this -> parts [ $ part ] = $ expression ; return $ this ; }... | Adds an expression to the WHERE or HAVING clause . |
50,845 | private function getSelectQuery ( ) { return 'SELECT ' . ( empty ( $ this -> parts [ 'select' ] ) ? '*' : implode ( ', ' , $ this -> parts [ 'select' ] ) ) . ' FROM ' . $ this -> getFromClause ( ) . ( ( $ this -> parts [ 'where' ] !== null ) ? ' WHERE ' . $ this -> parts [ 'where' ] : null ) . ( ! empty ( $ this -> par... | Generates a SELECT query |
50,846 | private function getInsertQuery ( ) { return 'INSERT INTO ' . $ this -> parts [ 'from' ] [ 0 ] [ 'table' ] . ' (' . implode ( ', ' , array_keys ( $ this -> parts [ 'set' ] ) ) . ')' . ' VALUES' . ' (' . implode ( ', ' , $ this -> parts [ 'set' ] ) . ')' ; } | Generates an INSERT query . |
50,847 | private function getUpdateQuery ( ) { if ( isset ( $ this -> parts [ 'from' ] [ 0 ] [ 'alias' ] ) ) { $ fromClause = $ this -> parts [ 'from' ] [ 0 ] [ 'alias' ] . ' FROM ' . $ this -> getFromClause ( ) ; } else { $ fromClause = $ this -> parts [ 'from' ] [ 0 ] [ 'table' ] ; } $ setClause = array ( ) ; foreach ( $ this... | Generates an UPDATE query . |
50,848 | private function getDeleteQuery ( ) { $ fromClause = null ; if ( isset ( $ this -> parts [ 'from' ] [ 0 ] [ 'alias' ] ) ) { $ fromClause = $ this -> parts [ 'from' ] [ 0 ] [ 'alias' ] . ' ' ; } $ fromClause .= 'FROM ' . $ this -> getFromClause ( ) ; return 'DELETE ' . $ fromClause . ( ( $ this -> parts [ 'where' ] !== ... | Generates a DELETE query . |
50,849 | private function getFromClause ( ) { $ fromClauses = array ( ) ; foreach ( $ this -> parts [ 'from' ] as $ from ) { $ fromClause = $ from [ 'table' ] ; if ( $ from [ 'alias' ] !== null ) { $ fromClause .= ' ' . $ from [ 'alias' ] ; } if ( isset ( $ this -> parts [ 'join' ] [ $ from [ 'alias' ] ] ) ) { foreach ( $ this ... | Generates the FROM clause . |
50,850 | public static function cleanExtension ( ? string $ string ) : ? string { if ( ! self :: contains ( '.' , $ string ) ) { return $ string ; } $ splited = explode ( '.' , $ string ) ; array_pop ( $ splited ) ; return implode ( '.' , $ splited ) ; } | Remove extension from string |
50,851 | public static function upperCase ( ? string $ string = null ) : ? string { if ( $ string === null ) { return null ; } return mb_strtoupper ( $ string , 'UTF-8' ) ; } | Change content to upper case . Analog of strtoupper with UTF - 8 |
50,852 | public static function splitCamelCase ( string $ string , string $ glue = ' ' ) : string { $ expression = '/(?#! splitCamelCase Rev:20140412) # Split camelCase "words". Two global alternatives. Either g1of2: (?<=[a-z]) # Position is after a lowercase, ... | Split camel case words with glue . camelCaseWords = > Camel case words |
50,853 | public static function concat ( ) { $ args = func_get_args ( ) ; $ separator = array_shift ( $ args ) ; $ output = null ; foreach ( $ args as $ string ) { $ output .= $ string . $ separator ; } $ output = rtrim ( $ output , $ separator ) ; return $ output ; } | Concat string with add string by separator |
50,854 | function btn ( $ label , $ tagbody ) { return $ this -> button ( $ label , null , $ tagbody ) -> set ( 'type' , null ) ; } | Same as button only it doenst submit data . |
50,855 | function errors ( $ fieldname ) { if ( $ fieldname == null ) { return null ; } else { if ( $ this -> errors !== null ) { if ( isset ( $ this -> errors [ $ fieldname ] ) ) { return $ this -> errors [ $ fieldname ] ; } else { return null ; } } } } | Retrieves errors for a given field or all errors if no field is specified . |
50,856 | function addfieldconfigurer ( callable $ configurer , $ fieldtypes = null ) { $ fieldtypes != null or $ fieldtypes = 'field' ; is_array ( $ fieldtypes ) or $ fieldtypes = [ $ fieldtypes ] ; foreach ( $ fieldtypes as $ fieldtype ) { $ this -> fieldconfigurers [ $ fieldtype ] = $ configurer ; } return $ this ; } | Adds a configurer to the field . The configurer is called by the fields during rendering . The configurer is primarily used for formatting . |
50,857 | public function aroundGetNotLoggedInGroup ( \ Magento \ Customer \ Model \ GroupManagement $ subject , \ Closure $ proceed ) { $ result = $ proceed ( ) ; $ code = $ this -> hlpReferral -> getReferralCode ( ) ; if ( $ code ) { $ groupId = $ this -> hlpConfig -> getReferralsGroupReferrals ( ) ; $ result = $ this -> daoCu... | Get referral group data instead of anonymous group . |
50,858 | public static function add ( $ key , $ value ) { if ( null === $ value && is_array ( $ key ) ) { foreach ( $ key as $ index => $ value ) { static :: $ data [ $ index ] = $ value ; } return ; } if ( true === isset ( static :: $ data [ $ key ] ) && true === is_array ( static :: $ data [ $ key ] ) ) { if ( true === is_arr... | Stores a new piece of data and tries to merge the data if already exists |
50,859 | public static function set ( $ key , $ value ) { if ( false === is_string ( $ key ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ key ) ) , E_USER_ERROR ) ; } static :: $ data [ $ key ] = $ value ; } | Stores a new piece of data and overwrites the data if already exists |
50,860 | public static function remove ( $ key ) { if ( false === is_string ( $ key ) ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string, "%s" given' , __METHOD__ , gettype ( $ key ) ) , E_USER_ERROR ) ; } if ( $ key && isset ( static :: $ data [ $ key ] ) ) { unset ( static :: $ data [ $... | Remove data based on key |
50,861 | public function set ( $ number ) { $ this -> setCurrentValue ( $ number ) ; $ this -> currentOperation = 'add' ; $ this -> addToHistory ( 'set' , $ number ) ; return $ this ; } | Sets the current value . |
50,862 | protected function performOperationOnExpressionEngine ( $ operation , $ number ) { $ this -> currentOperation = $ operation ; if ( is_array ( $ number ) ) { foreach ( $ number as $ actualNumber ) { $ this -> { $ operation } ( $ actualNumber ) ; } } else { $ this -> addToHistory ( $ operation , $ number ) ; $ this -> se... | Helper function to recursively call a method on the FluentCalculator and the underlying expression engine . |
50,863 | public function add ( $ number = null ) { if ( $ number == null ) { $ this -> internalSetOperationModeWithHistory ( 'add' ) ; } elseif ( $ number instanceof Closure ) { $ this -> internalSetOperationModeWithHistory ( 'add' ) ; return $ this -> group ( $ number ) ; } else { $ this -> performOperationOnExpressionEngine (... | Adds a given number to the current value . |
50,864 | public function subtract ( $ number = null ) { if ( $ number == null ) { $ this -> internalSetOperationModeWithHistory ( 'subtract' ) ; } elseif ( $ number instanceof Closure ) { $ this -> internalSetOperationModeWithHistory ( 'subtract' ) ; return $ this -> group ( $ number ) ; } else { $ this -> performOperationOnExp... | Subtracts a given number from the current value . |
50,865 | public function multiply ( $ number = null ) { if ( $ number === null ) { $ this -> internalSetOperationModeWithHistory ( 'multiply' ) ; } elseif ( $ number instanceof Closure ) { $ this -> internalSetOperationModeWithHistory ( 'multiply' ) ; return $ this -> group ( $ number ) ; } else { $ this -> performOperationOnEx... | Multiplies the current value by a given number . |
50,866 | public function divide ( $ number = null ) { if ( $ number === null ) { $ this -> internalSetOperationModeWithHistory ( 'divide' ) ; } elseif ( $ number instanceof Closure ) { $ this -> internalSetOperationModeWithHistory ( 'divide' ) ; return $ this -> group ( $ number ) ; } else { $ this -> performOperationOnExpressi... | Divides the current value by a given number . |
50,867 | public function round ( $ number , $ precision = 0 , $ mode = PHP_ROUND_HALF_UP ) { return $ this -> runExpressionFunction3Param ( 'round' , $ number , $ precision , $ mode ) ; } | Rounds a number to the nearest value . |
50,868 | public function evaluate ( ) { $ path = $ this -> getPath ( ) ; if ( $ path === null ) { throw new FusionException ( '"path" was not specified' , 1386458763 ) ; } $ package = $ this -> getPackage ( ) ; if ( $ package === null ) { $ controllerContext = $ this -> runtime -> getControllerContext ( ) ; $ actionRequest = $ ... | Returns the absolute URL of a resource with cache bursting string |
50,869 | protected function getPropertyFilepaths ( ) { $ file = $ this -> basename . '.properties' ; if ( $ this -> MessageService -> fileExists ( $ file ) ) return $ this -> MessageService -> resolveFile ( $ file ) -> getLocalPath ( ) ; return null ; } | Get a list of reverse - specific absolute property file paths |
50,870 | public function setRole ( $ role_id ) { if ( ! empty ( $ role_id ) && $ this -> policy === Rule :: NOINHERIT ) throw new Exception ( "Rule::NOINHERIT can not be used in combination with a role" ) ; if ( $ role_id instanceof Role ) { $ this -> role = $ role_id ; $ role_id = $ role_id -> getID ( ) ; } elseif ( ! is_scala... | Set the role this Rule applies to . |
50,871 | public function setEntity ( $ entity_id ) { if ( $ entity_id instanceof Entity ) { $ this -> entity = $ entity_id ; $ entity_id = $ entity_id -> getID ( ) ; } elseif ( ! is_scalar ( $ entity_id ) ) throw new Exception ( "Entity-ID must be an Entity or a scalar" ) ; if ( $ entity_id !== $ this -> entity_id ) { $ this ->... | Set the entity this Rule applies to |
50,872 | public function setPolicy ( int $ policy ) { if ( ! ( $ policy === Rule :: ALLOW || $ policy === Rule :: DENY || $ policy === Rule :: INHERIT || $ policy === Rule :: NOINHERIT ) ) throw new Exception ( "Policy must be either Rule::ALLOW, Rule::DENY, Rule::INHERIT or Rule::NOINHERIT" ) ; if ( $ policy === Rule :: NOINHE... | Set the policy on the entity |
50,873 | public function setAction ( string $ action ) { if ( ! empty ( $ action ) && $ this -> policy === Rule :: NOINHERIT ) throw new Exception ( "Rule::NOINHERIT can not be used in combination with an action" ) ; $ action = ( string ) $ action ; if ( $ action !== $ this -> action ) { $ validator = $ this -> acl -> getAction... | Set the action on the entity |
50,874 | public static function isRegistered ( $ runtime = false ) { $ extension = $ runtime ? self :: EXTN_RUNTIME : self :: EXTN_HANDLEBARS ; return isset ( V8Js :: getExtensions ( ) [ $ extension ] ) ; } | Returns true if the handlebars has been registered with V8Js |
50,875 | public static function registerHandlebarsExtension ( $ source , $ runtime = false ) { if ( ! self :: isRegistered ( $ runtime ) ) { $ extension = $ runtime ? self :: EXTN_RUNTIME : self :: EXTN_HANDLEBARS ; V8Js :: registerExtension ( $ extension , $ source , [ ] , false ) ; } } | Registers handlebars script with V8Js |
50,876 | public static function create ( $ runtime = false , $ extensions = [ ] , $ report_uncaught_exceptions = true ) { return new Handlebars ( $ runtime , $ extensions , $ report_uncaught_exceptions ) ; } | Returns configured Handlebars instance |
50,877 | public function precompile ( $ template , $ options = [ ] ) { if ( $ this -> isRuntime ) { throw new \ BadMethodCallException ( "Cannot precompile templates using runtime" ) ; } $ this -> v8 -> template = $ template ; $ this -> v8 -> options = $ options ; return $ this -> v8 -> executeString ( 'jsHb.precompile(phpHb.te... | Precompiles a given template so it can be sent to the client and executed without compilation |
50,878 | public function registerPartial ( $ name , $ partial = false ) { $ partials = [ ] ; if ( is_array ( $ name ) ) { $ partials = $ name ; } elseif ( is_object ( $ name ) ) { $ partials = get_object_vars ( $ name ) ; } if ( count ( $ partials ) ) { $ this -> registerPhpArray ( 'partial' , $ partials ) ; } elseif ( $ partia... | Registers partials accessible by any template in the environment |
50,879 | public function registerHelper ( $ name , $ helper = false ) { if ( is_array ( $ name ) ) { foreach ( $ name as $ n => $ helper ) { $ this -> registerHelper ( $ n , $ helper ) ; } } elseif ( is_object ( $ name ) ) { $ this -> registerJavascriptObject ( 'helper' , $ this -> wrapHelperObject ( $ name ) ) ; } elseif ( $ h... | Registers helpers accessible by any template in the environment |
50,880 | public function registerDecorator ( $ name , $ decorator ) { if ( is_object ( $ name ) ) { $ this -> registerJavascriptObject ( 'decorator' , $ this -> wrapDecoratorObject ( $ name ) ) ; } elseif ( $ decorator === false ) { $ this -> registerJavascriptObject ( 'decorator' , $ name ) ; } elseif ( is_callable ( $ decorat... | Registers a decorator accessible by any template in the environment |
50,881 | public static function is_int_val ( $ val ) { if ( is_int ( $ val ) ) return true ; if ( is_bool ( $ val ) ) return false ; if ( ! is_string ( $ val ) ) return false ; return ( string ) ( ( int ) $ val ) === $ val ; } | Check if the provided value contains an integer value . The value may be an int or anything convertable to an int . After conversion the string representation of the value before and after conversion are compared and if they are equal the value is considered a proper integral value . |
50,882 | public static function str ( $ obj , $ html = false , $ depth = 0 ) { if ( is_null ( $ obj ) ) return "NULL" ; if ( is_bool ( $ obj ) ) return $ obj ? "TRUE" : "FALSE" ; if ( is_scalar ( $ obj ) ) return ( string ) $ obj ; $ str = "" ; if ( $ obj instanceof Throwable ) { $ str = self :: exceptionToString ( $ obj ) ; } ... | Convert any object to a string representation . |
50,883 | public static function sprint_r ( $ obj ) { ob_start ( ) ; print_r ( $ obj ) ; $ str = ob_get_contents ( ) ; ob_end_clean ( ) ; $ str = preg_replace ( "/\s+\\(\s+/" , " ( " , $ str ) ; $ str = preg_replace ( "/\n\s+/" , ", " , $ str ) ; $ str = preg_replace ( "/\n\s*\\)/" , " )" , $ str ) ; return $ str ; } | Format an object using print_r formatting to a singe line object notation |
50,884 | public static function debug ( string $ format ) { if ( ! is_resource ( self :: $ debug_stream ) ) self :: $ debug_stream = fopen ( 'php://output' , 'w' ) ; $ args = func_get_args ( ) ; foreach ( $ args as $ idx => & $ arg ) { if ( $ idx === 0 ) $ arg .= PHP_SAPI === 'cli' ? "\n" : "<br>\n" ; if ( ! is_scalar ( $ arg )... | Log an output message to a specified stream |
50,885 | public static function fillPlaceholders ( string $ msg , array $ values ) { foreach ( $ values as $ key => $ value ) $ msg = str_replace ( '{' . $ key . '}' , self :: str ( $ value ) , $ msg ) ; return $ msg ; } | Fill a placeholder string |
50,886 | public static function clamp ( int $ value , int $ min , int $ max ) { return $ value < $ min ? $ min : ( $ value > $ max ? $ max : $ value ) ; } | Restrict the value to a specific valid range . |
50,887 | protected static function translateParsedLocaleToAppValue ( \ stdClass $ parsedLocale ) { if ( ! static :: $ windowsPlatform ) { $ result = $ parsedLocale ; } else { $ result = ( object ) array_merge ( [ ] , ( array ) $ parsedLocale ) ; if ( ! static :: $ LANGS ) static :: prepareWinConfigOppositeArrays ( ) ; $ langAnd... | Translate parsed system locale value into application locale value . Do not translate anything on non - windows plaforms but translate windows system locale value language terotiry and encoding combination into standard application values . |
50,888 | public function verifyAuthentication ( Registration $ registration , SignRequest $ request , SignResponse $ response ) { if ( ! $ this -> appId -> equals ( new AppId ( $ request -> appId ) ) ) { return AuthenticationVerificationResult :: appIdMismatch ( ) ; } if ( $ response -> errorCode > 0 ) { return AuthenticationVe... | Request signing of a sign request . Does not support U2F s sign counter system . |
50,889 | public function serialize ( ) { $ data = array ( ) ; foreach ( get_object_vars ( $ this ) as $ propertyName => $ propertyValue ) { $ data [ $ propertyName ] = $ propertyValue ; } return serialize ( $ data ) ; } | Implements of \ Serializable |
50,890 | public function unserialize ( $ str ) { $ data = @ unserialize ( $ str ) ; if ( $ data === false ) { throw new \ RuntimeException ( sprintf ( 'Can\'t unserialize model data: %s' , $ str ) ) ; } if ( ! is_array ( $ data ) ) { throw new \ RuntimeException ( sprintf ( 'Unserialized data must be array, "%s" given.' , getty... | Implements if \ Serializable |
50,891 | public function get ( $ key = false , $ default = false ) { if ( $ key === false ) { return $ this -> params ; } if ( ! $ this -> has ( $ key ) && $ default === false ) { return new Param ( $ key , null ) ; } if ( ! $ this -> has ( $ key ) && $ default !== false ) { return new Param ( $ key , $ default ) ; } return new... | Get param value by key or false for all params Optional set default if not found |
50,892 | protected function _getCurrentIterableKey ( & $ iterable ) { $ current = $ this -> _getCurrentIterableValue ( $ iterable ) ; return ( $ current instanceof KeyAwareInterface ) ? $ current -> getKey ( ) : key ( $ iterable ) ; } | Retrieves the key for the current element of an iterable . |
50,893 | private function registerOtherComposers ( ) { $ this -> composer ( 'auth::admin.roles._partials.permissions-checkbox' , 'Arcanesoft\Auth\ViewComposers\PermissionsComposer@composeRolePermissions' ) ; $ this -> composer ( 'auth::admin.users.index' , 'Arcanesoft\Auth\ViewComposers\RolesComposer@composeFilters' ) ; $ this ... | Register other view composers . |
50,894 | public function addField ( $ field , $ title , array $ rules = array ( ) ) { $ this -> _fields [ $ field ] = $ title ; if ( $ rules ) { foreach ( $ rules as $ rule => $ options ) { if ( is_numeric ( $ rule ) ) { $ rule = $ options ; $ options = array ( ) ; } $ this -> addRule ( $ field , $ rule , null , $ options ) ; }... | Add a field to be used in validation . Can optionally apply an array of validation rules . |
50,895 | public function addRule ( $ field , $ rule , $ message , $ options = array ( ) ) { if ( empty ( $ this -> _fields [ $ field ] ) ) { throw new InvalidArgumentException ( sprintf ( 'Field %s does not exist' , $ field ) ) ; } if ( isset ( $ this -> _messages [ $ rule ] ) ) { $ message = $ message ? : $ this -> _messages [... | Add a validation rule to a field . Can supply an optional error message and options . |
50,896 | public function validate ( ) { if ( ! $ this -> _data ) { return false ; } $ fields = $ this -> getFields ( ) ; $ messages = $ this -> getMessages ( ) ; foreach ( $ this -> _data as $ field => $ value ) { if ( empty ( $ this -> _rules [ $ field ] ) ) { continue ; } foreach ( $ this -> _rules [ $ field ] as $ rule => $ ... | Validate the data against the rules schema . Return true if all fields passed validation . |
50,897 | public static function makeFromShorthand ( array $ data = array ( ) , array $ fields = array ( ) ) { $ obj = new static ( $ data ) ; foreach ( $ fields as $ field => $ data ) { $ title = $ field ; if ( is_string ( $ data ) ) { $ data = array ( 'rules' => $ data ) ; } else if ( ! is_array ( $ data ) ) { continue ; } els... | Create a validator instance from a set of shorthand or expanded rule sets . |
50,898 | public static function splitShorthand ( $ shorthand ) { $ rule = null ; $ message = '' ; $ opts = array ( ) ; if ( strpos ( $ shorthand , ':' ) !== false ) { $ parts = explode ( ':' , $ shorthand , 3 ) ; $ rule = $ parts [ 0 ] ; if ( ! empty ( $ parts [ 1 ] ) ) { $ opts = $ parts [ 1 ] ; if ( strpos ( $ opts , ',' ) !=... | Split a shorthand rule into multiple parts . |
50,899 | public function write ( Response $ response , $ value ) { $ cookie = $ this -> createCookieWithValue ( $ value ) ; $ response -> headers -> setCookie ( $ cookie ) ; return $ cookie ; } | Write a new value for the current cookie to a given Response . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.