idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
53,700
final private static function _hasFileKeys ( Array $ file ) : Bool { $ valid = true ; foreach ( [ 'error' , 'tmp_name' , 'type' , 'size' , 'name' ] as $ key ) { if ( ! array_key_exists ( $ key , $ file ) ) { $ valid = false ; break ; } } return $ valid ; }
Verifies that an array has all keys expected of a file upload
53,701
public function cmdGetCart ( ) { $ result = $ this -> getListCart ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableCart ( $ result ) ; $ this -> output ( ) ; }
Callback for cart - get command
53,702
public function cmdDeleteCart ( ) { $ id = $ this -> getParam ( 0 ) ; $ options = null ; if ( $ this -> getParam ( 'user' ) ) { $ options = array ( 'user_id' => $ id ) ; } else if ( $ this -> getParam ( 'sku' ) ) { $ options = array ( 'sku' => $ id ) ; } else if ( $ this -> getParam ( 'order' ) ) { if ( ! is_numeric ( ...
Callback for cart - delete command
53,703
protected function getListCart ( ) { $ id = $ this -> getParam ( 0 ) ; if ( ! isset ( $ id ) ) { return $ this -> cart -> getList ( array ( 'limit' => $ this -> getLimit ( ) ) ) ; } if ( $ this -> getParam ( 'user' ) ) { return $ this -> cart -> getList ( array ( 'user_id' => $ id , 'limit' => $ this -> getLimit ( ) ) ...
Returns an array of cart items
53,704
protected function submitAddCart ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> setSubmittedJson ( 'data' ) ; $ this -> validateComponent ( 'cart' ) ; $ this -> addAddCart ( ) ; }
Add a new cart item at once
53,705
protected function wizardAddCart ( ) { $ this -> validatePrompt ( 'user_id' , $ this -> text ( 'User ID' ) , 'cart' ) ; $ this -> validatePrompt ( 'product_id' , $ this -> text ( 'Product ID' ) , 'cart' ) ; $ this -> validatePrompt ( 'sku' , $ this -> text ( 'Product SKU' ) , 'cart' ) ; $ this -> validatePrompt ( 'stor...
Add a new cart item step by step
53,706
protected function addAddCart ( ) { if ( ! $ this -> isError ( ) ) { $ id = $ this -> cart -> add ( $ this -> getSubmitted ( ) ) ; if ( empty ( $ id ) ) { $ this -> errorAndExit ( $ this -> text ( 'Unexpected result' ) ) ; } $ this -> line ( $ id ) ; } }
Add a new cart item
53,707
protected function bindContext ( $ object = NULL ) { if ( $ object !== NULL && ! is_object ( $ object ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Expecting an object, given %s' , gettype ( $ object ) ) ) ; } $ previous = $ this -> context ; $ this -> context = $ object ; if ( $ object === NULL ) { $ this ->...
Bind the scope to the given object .
53,708
protected function unbindContext ( $ object , $ terminate = true ) { if ( ! is_object ( $ object ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Expecting an object, given %s' , gettype ( $ object ) ) ) ; } if ( $ this -> context === $ object ) { $ this -> context = NULL ; $ this -> proxies = new \ SplObjectSto...
Unbind scope from the given object will optionally destroy all contextual instances bound to the object .
53,709
protected function initializeProxy ( $ typeName , callable $ factory = NULL ) { $ proxyName = $ this -> container -> loadScopedProxy ( $ typeName ) ; if ( $ factory === NULL ) { $ factory = function ( ) { throw new ScopeNotActiveException ( sprintf ( 'Scope "%s" is not active' , $ this -> getScope ( ) ) ) ; } ; } retur...
Create a scoped proxy for the given type .
53,710
protected function bindFactoryProxy ( $ typeName , callable $ factory ) { $ proxy = $ this -> initializeProxy ( $ typeName , $ factory ) ; $ this -> scopedProxies [ $ proxy -> K2GetProxyBinding ( ) ] = $ proxy ; $ this -> container -> bindInstance ( $ typeName , $ proxy , true ) ; return $ proxy ; }
Creates a factory - based proxy for the target type and binds it to the DI container .
53,711
protected function removeFilesAndDirectories ( ) { $ this -> laravel [ 'files' ] -> deleteDirectory ( config ( 'lia.directory' ) ) ; $ this -> laravel [ 'files' ] -> deleteDirectory ( public_path ( 'vendor/lia/' ) ) ; $ this -> laravel [ 'files' ] -> delete ( config_path ( 'lia.php' ) ) ; $ this -> laravel [ 'files' ] ...
Remove files and directories .
53,712
public function addScheduleItem ( ProductionMenuCollectionEvent $ event ) : void { $ menu = $ event -> getMenu ( ) ; $ group = $ event -> getGroup ( ) ; $ schedule = $ this -> factory -> createItem ( 'menu_item.schedule' , [ 'route' => 'bkstg_calendar_production' , 'routeParameters' => [ 'production_slug' => $ group ->...
Add the schedule menu item .
53,713
public function setApiClient ( \ Inwendo \ Latex \ Common \ ApiClient $ apiClient ) { $ this -> apiClient = $ apiClient ; return $ this ; }
Set the API client
53,714
public function addAliases ( $ alias ) { foreach ( func_get_args ( ) as $ alias ) { $ this -> aliases [ $ alias ] = true ; } return $ this ; }
Add one or more aliases to the field
53,715
public function setExportHandler ( $ type ) { if ( $ type === self :: EXPORT_NORMAL || $ type === self :: EXPORT_ARRAY || $ type === self :: EXPORT_SKIP || is_callable ( $ type ) ) { $ this -> exportHandler = $ type ; return $ this ; } throw new InvalidArgumentException ( "invalid value provided for 'type'; " . "expect...
Set the method by which to export the value
53,716
public function addValue ( $ value , $ index = null ) { if ( $ this -> value === null ) { $ this -> value = [ ] ; } if ( $ index === null ) { $ this -> value [ ] = $ value ; } else { $ this -> value [ $ index ] = $ value ; } return $ this ; }
Add a value
53,717
public function setValue ( $ value , $ index = null ) { if ( $ index === null ) { $ this -> value = Arr :: cast ( $ value ) ; } else { $ this -> value [ $ index ] = $ value ; } return $ this ; }
Set one or all values
53,718
public function getValue ( $ index = 0 ) { if ( $ index === 0 && $ this -> value === null ) { return $ this -> defaultValue ; } return ( is_array ( $ this -> value ) && array_key_exists ( $ index , $ this -> value ) ) ? $ this -> value [ $ index ] : null ; }
Get a single value
53,719
private function getValuesAsArray ( ) { if ( $ this -> value === null ) { return is_array ( $ this -> defaultValue ) ? $ this -> defaultValue : [ $ this -> defaultValue ] ; } return $ this -> value ; }
Get all of the current values as an array of values
53,720
public function addRule ( Rule $ rule ) { $ classname = $ rule -> getClass ( ) ; if ( $ this -> hasRule ( $ classname ) === true ) { throw new Exception ( "failed to add rule; the field {$this->name} already has an " . "instance of '$classname'" ) ; } else if ( $ classname === Rule :: REQUIRED ) { $ this -> rules = [ $...
Add a validation rule to the field
53,721
public function validate ( Collection $ collection = null ) { $ this -> errors = [ ] ; foreach ( $ this -> getValuesAsArray ( ) as $ index => $ value ) { if ( $ value === null && $ this -> hasRule ( Rule :: REQUIRED ) === false ) { continue ; } foreach ( $ this -> rules as $ name => $ rule ) { $ rule -> setValue ( $ va...
Validate all the values in the field
53,722
public function matchRoot ( & $ request ) { if ( empty ( $ this -> _patterns ) ) { return true ; } $ path = $ request -> getPathToMatch ( ) ; $ method = $ request -> getMethod ( ) ; foreach ( $ this -> _patterns as $ pattern ) { if ( $ matched = Matcher :: verify ( $ pattern , $ path , $ method ) ) { if ( isset ( $ mat...
check if the requested path matches with the root .
53,723
public function flushAll ( ) { $ mask = '*' . self :: CACHE_FILE_SUFFIX ; foreach ( glob ( $ this -> basePath . $ mask ) as $ cacheFilePath ) { if ( ! unlink ( $ cacheFilePath ) ) { throw new \ RuntimeException ( "Failed to delete cache file '{$cacheFilePath}'." ) ; } } }
Deletes every cache file .
53,724
protected function loadRouting ( ) { $ parser = new YamlParser ( ) ; $ routes = array ( ) ; foreach ( $ this -> getRoutingFiles ( ) as $ file ) { $ routes = array_merge ( $ routes , $ parser -> parse ( file_get_contents ( $ file ) ) ) ; } foreach ( $ routes as $ name => $ routeInfos ) { $ this -> processRouteInfos ( $ ...
Load routing from routing files
53,725
private function processRouteInfos ( $ name , array $ routeInfos ) { $ className = null ; if ( isset ( $ routeInfos [ 'sequence' ] ) ) { $ className = $ routeInfos [ 'sequence' ] ; $ this -> container [ 'core' ] [ 'router' ] -> addRouteSequence ( $ className ) ; } if ( isset ( $ routeInfos [ 'pattern' ] ) ) { if ( ! is...
Process route infos
53,726
private function iterarEntradas ( $ busquedaLdap , array $ atributos ) { $ datos = array ( ) ; if ( ( $ entrada = ldap_first_entry ( $ this -> conexionLdap , $ busquedaLdap ) ) ) { do { $ datos [ ] = $ this -> mapa ( $ atributos , $ entrada ) ; } while ( $ entrada = ldap_next_entry ( $ this -> conexionLdap , $ entrada ...
Auxiliar directo de busqueda . Dado un ldap result itera por el para conseguir sus datos
53,727
public static function ordinalize ( $ number ) { if ( in_array ( ( $ number % 100 ) , range ( 11 , 13 ) ) ) { return $ number . 'th' ; } switch ( $ number % 10 ) { case 1 : return $ number . 'st' ; case 2 : return $ number . 'nd' ; case 3 : return $ number . 'rd' ; default : return $ number . 'th' ; } }
Converts number to its ordinal English form . For example converts 13 to 13th 2 to 2nd ...
53,728
public function pixelate ( $ blocksize = 5 , $ effect = 50 ) { $ this -> filter ( IMG_FILTER_PIXELATE , $ blocksize , $ effect ) ; return $ this -> image ; }
Give current image a pixelate filter
53,729
private function createImage ( $ x , $ y , $ width , $ height , $ new_width , $ new_height , $ interlace = false ) { $ resource = imagecreatetruecolor ( $ new_width , $ new_height ) ; if ( false === imagesavealpha ( $ resource , true ) ) { trigger_error ( 'Could not set the flag to save full alpha channel' , E_USER_ERR...
Creates new image resource . Returns false if failed .
53,730
public function substring ( ) { $ start = $ this -> getParameter ( 'start' ) ; $ length = $ this -> getParameter ( 'length' ) ; if ( empty ( $ start ) ) $ start = 0 ; if ( empty ( $ length ) ) $ length = strlen ( $ this -> getParameter ( 'value' ) ) - ( int ) $ start ; $ str = substr ( $ this -> getParameter ( 'value' ...
Returns a substring from param value . Returns the 1st letter if only value is specified
53,731
public function showVars ( ) { $ what = $ this -> getParameter ( 'scope' ) ; switch ( $ what ) { case 'global' : case 'globals' : case 'system' : case 'systems' : $ debug = $ this -> getGlobals ( ) ; break ; default : $ debug = $ this -> getLocals ( ) ; break ; } return '<pre>' . JSONUtils :: encode ( $ debug , true , ...
Returns debuggging information about the current vars
53,732
public function htmlEscape ( ) { if ( $ this -> getParameter ( 'value' ) == null ) return ; return str_replace ( '%' , '&#37;' , htmlentities ( $ this -> getParameter ( 'value' ) , ENT_QUOTES , 'UTF-8' , false ) ) ; }
HTML - Escapes the specified parameter . Converts all html chars into their entities equivalent
53,733
function strReplace ( ) { if ( ( $ this -> getParameter ( 'needle' ) == null ) || ( $ this -> getParameter ( 'haystack' ) == null ) ) return $ this -> getParameter ( 'haystack' ) ; $ needle = $ this -> getParameter ( 'needle' ) ; if ( $ needle == '\n' ) $ needle = "\n" ; return str_replace ( $ needle , $ this -> getPar...
Performs a string replace on the specified param
53,734
public function pregReplace ( ) { if ( $ this -> getParameter ( 'pattern' ) == null ) return $ this -> getParameter ( 'subject' ) ; return preg_replace ( $ this -> getParameter ( 'pattern' ) , $ this -> getParameter ( 'replace' ) , $ this -> getParameter ( 'subject' ) ) ; }
Performs a regular expression search and replace
53,735
protected function firstLetter ( ) { $ string = trim ( ( string ) $ this -> getParameter ( 'string' ) ) ; $ lower = ( boolean ) $ this -> getParameter ( 'lower' ) ; return StringUtils :: firstLetter ( $ string , $ lower ) ; }
Return the first character from a string .
53,736
public function trim ( ) { return StringUtils :: trim ( $ this -> getParameter ( 'value' ) , $ this -> getParameter ( 'len' ) , $ this -> getParameter ( 'keeptags' ) , $ this -> getParameter ( 'decodehtml' ) , $ this -> getParameter ( 'stripurls' ) ) ; }
Trims a string to a specified length . It will allow tags listed in KeepTags to remain and will intelligently append the trimmed text with ... or - depending on if the trim ends on a word or a space .
53,737
public function wordCount ( ) { $ count = 0 ; foreach ( $ this -> getParameters ( ) as $ value ) $ count += str_word_count ( strip_tags ( $ value ) ) ; return $ count ; }
Returns the total count of all words in all params passed
53,738
public function charCount ( ) { $ count = 0 ; foreach ( $ this -> getParameters ( ) as $ value ) $ count += strlen ( strip_tags ( $ value ) ) ; return $ count ; }
Returns the total count of all characters in all params passed
53,739
public function pluralize ( ) { if ( $ this -> getParameter ( 'upperCaseFirst' ) == 'true' ) return ucfirst ( StringUtils :: pluralize ( $ this -> getParameter ( 'value' ) ) ) ; return StringUtils :: pluralize ( $ this -> getParameter ( 'value' ) ) ; }
Returns the plural version of the parameter in value
53,740
public function repeat ( ) { if ( $ this -> getParameter ( 'value' ) == null ) return ; $ value = $ this -> getParameter ( 'value' ) ; $ multiplier = $ this -> getParameter ( 'multiplier' ) ; $ offset = $ this -> getParameter ( 'offset' ) ; return str_repeat ( $ value , ( int ) $ multiplier + ( int ) $ offset ) ; }
Returns the supplied snippet repeated X times
53,741
public function implode ( ) { if ( ! is_array ( $ this -> getParameter ( 'value' ) ) ) { return $ this -> getParameter ( 'value' ) ; } $ glue = $ this -> getParameter ( 'glue' ) ; if ( $ glue === null ) { $ glue = '&nbsp;' ; } return implode ( $ glue , $ this -> getParameter ( 'value' ) ) ; }
Implode Array to String
53,742
public function sortBy ( $ columnName , $ asc = TRUE ) { $ sort = new \ stdClass ( ) ; $ sort -> column = $ columnName ; $ sort -> asc = ! ! $ asc ; $ this -> columnSorts [ ] = $ sort ; return $ this ; }
add ORDER BY clause
53,743
protected function buildQueryString ( ) { $ w = [ ] ; $ s = [ ] ; $ qc = $ this -> quoteChar ; $ this -> sql = 'SELECT ' ; if ( ! $ this -> columns || ! count ( $ this -> columns ) ) { $ this -> sql .= '*' ; } else { $ this -> sql .= $ qc . str_replace ( '.' , $ qc . '.' . $ qc , implode ( $ qc . ',' . $ qc , $ this ->...
builds query string by parsing WHERE and ORDER BY clauses
53,744
protected function buildValuesArray ( ) { foreach ( $ this -> whereClauses as $ where ) { if ( is_null ( $ where -> value ) ) { continue ; } if ( is_array ( $ where -> value ) ) { $ this -> valuesToBind = array_merge ( $ this -> valuesToBind , $ where -> value ) ; } else { $ this -> valuesToBind [ ] = $ where -> value ...
prepares array containing values which must be bound to prepared statement
53,745
protected function executeQuery ( ) { $ this -> lastQuerySql = $ this -> sql ; return $ this -> dbConnection -> doPreparedQuery ( $ this -> sql , $ this -> valuesToBind ) ; }
bind values and execute the SQL statement returns array of records
53,746
public static function fromArray ( array $ data ) { return new self ( ! empty ( $ data [ 'code' ] ) ? $ data [ 'code' ] : null , ! empty ( $ data [ 'message' ] ) ? $ data [ 'message' ] : null , ! empty ( $ data [ 'data' ] ) ? $ data [ 'data' ] : null ) ; }
Create object from array
53,747
public function toArray ( ) { $ error = array ( 'code' => $ this -> getCode ( ) , 'message' => $ this -> getMessage ( ) , ) ; if ( $ this -> getData ( ) ) { $ error [ 'data' ] = $ this -> getData ( ) ; } return $ error ; }
Transform object to array
53,748
public function getMessageString ( $ errorCode ) { return isset ( $ this -> errorMessages [ $ errorCode ] ) ? $ this -> errorMessages [ $ errorCode ] : null ; }
Return message string by code
53,749
public function getSane ( $ shift = 1 , $ limitOrFilter = null ) { $ backtrace = $ this -> trace ; while ( $ shift -- > 0 ) { array_shift ( $ backtrace ) ; } if ( is_numeric ( $ limitOrFilter ) ) { $ backtrace = array_slice ( $ backtrace , 0 , ( int ) $ limitOrFilter ) ; $ limitOrFilter = null ; } $ formattedTrace = ar...
Shift trace filter as required and fix the arguments object
53,750
private function traceComponentMakeSane ( $ trace ) { if ( isset ( $ trace [ 'args' ] ) ) { $ trace [ 'args' ] = array_map ( function ( $ arg ) { switch ( true ) { case is_object ( $ arg ) : return get_class ( $ arg ) ; case is_bool ( $ arg ) : return $ arg ? 'true' : 'false' ; case is_scalar ( $ arg ) : return $ arg ;...
Format a trace into a more managable output when massive objects are involved
53,751
public function release ( $ item ) { $ k = array_search ( $ item , $ this -> _inUseItems ) ; if ( $ k === FALSE ) return ; unset ( $ this -> _inUseItems [ $ k ] ) ; $ this -> _poolItems [ ] = $ item ; }
Free an item and replace it in the pool
53,752
public static function getLevelCode ( $ level ) { if ( is_string ( $ level ) && isset ( self :: $ levels [ $ level ] ) ) { return self :: $ levels [ $ level ] ; } throw new Exception \ InvalidArgumentException ( Message :: get ( Message :: INVALID_LOG_LEVEL , ( string ) $ level ) , Message :: INVALID_LOG_LEVEL ) ; }
Get level code by name
53,753
private static function _irr ( $ pval , $ payarray , $ fromdayone ) { $ low = 0.0 ; $ high = 100.0 ; $ lowval = self :: _npv ( $ pval , $ payarray , $ low , $ fromdayone ) ; $ highval = self :: _npv ( $ pval , $ payarray , $ high , $ fromdayone ) ; if ( $ lowval > 0.0 ) { return ( - 1 ) ; } do { $ mid = self :: _midpoi...
This function uses divide and conquer to numerically find the IRR Internal Rate of Return . It starts of by trying a low of 0% and a high of 100% . If this isn t enough it will double the interval up to 1000000% . Note that this is insanely high and if you try to convert an IRR that high to an APR you will get even mor...
53,754
private static function _fulpacc ( $ pval , $ rate , $ fee , $ minpay , $ payment , $ months , $ base ) { $ bal = $ pval ; $ payarray = array ( ) ; while ( ( $ months != 0 ) && ( $ bal > self :: $ accuracy ) ) { $ interest = $ bal * $ rate / ( 100.0 * 12 ) ; $ newbal = $ bal + $ interest + $ fee ; if ( $ minpay >= $ ne...
This is a simplified model of how our paccengine works if a client always pays their bills . It adds interest and fees and checks minimum payments . It will run until the value of the account reaches 0 and return an array of all the individual payments . Months is the amount of months to run the simulation . Important!...
53,755
private static function _aprAnnuity ( $ pval , $ months , $ rate , $ fee , $ minpay ) { $ payment = self :: _annuity ( $ pval , $ months , $ rate ) + $ fee ; if ( $ payment < 0 ) { return $ payment ; } $ payarray = self :: _fulpacc ( $ pval , $ rate , $ fee , $ minpay , $ payment , $ months , false ) ; $ apr = self :: ...
Calculate the APR for an annuity given the following inputs .
53,756
private static function _getPayArray ( $ sum , $ pclass , $ flags ) { $ monthsfee = 0 ; if ( $ flags === KlarnaFlags :: CHECKOUT_PAGE ) { $ monthsfee = $ pclass -> getInvoiceFee ( ) ; } $ startfee = 0 ; if ( $ flags === KlarnaFlags :: CHECKOUT_PAGE ) { $ startfee = $ pclass -> getStartFee ( ) ; } $ sum += $ startfee ; ...
Grabs the array of all monthly payments for specified PClass .
53,757
public static function pRound ( $ value , $ country ) { $ multiply = 1 ; $ country = KlarnaCountry :: getCode ( $ country ) ; switch ( $ country ) { case "FI" : case "DE" : case "NL" : case "AT" : $ multiply = 10 ; break ; } return floor ( ( $ value * $ multiply ) + 0.5 ) / $ multiply ; }
Rounds a value depending on the specified country .
53,758
public function where ( $ field , $ value , $ comparison = '==' , $ logical = 'and' ) { $ this -> conditions [ ] = [ $ field , $ value , $ comparison , $ logical ] ; return $ this ; }
Adds where condition to relation
53,759
protected function buildLocalKey ( $ entity , array $ pairs ) { $ keys = array_keys ( $ pairs ) ; return $ this -> buildKey ( $ entity , array_combine ( $ keys , $ keys ) ) ; }
Builds local key from field property pairs
53,760
protected function buildKey ( $ entity , array $ pairs ) { $ key = [ ] ; foreach ( $ pairs as $ local => $ refer ) { $ key [ ] = $ local . ':' . $ this -> accessor -> getPropertyValue ( $ entity , $ refer ) ; } return implode ( '-' , $ key ) ; }
Builds key from key - value pairs
53,761
protected function fetch ( $ entityName , array $ conditions , $ result = false ) { $ query = $ this -> storage -> read ( $ entityName ) ; foreach ( $ conditions as $ field => $ values ) { $ query -> where ( $ field , $ values ) ; } if ( ! $ result ) { return $ query -> execute ( ) ; } foreach ( $ this -> relations as ...
Fetches collection of entities matching set conditions Optionally sorts it and limits it
53,762
protected function assertInstance ( $ entity ) { $ entityClass = $ this -> definition -> entity ( ) ; if ( ! $ entity instanceof $ entityClass ) { throw new RelationException ( sprintf ( 'Relation entity must be instance of %s, got %s' , $ entityClass , $ this -> getType ( $ entity ) ) ) ; } return true ; }
Throws exception when entity is not required instance
53,763
protected function cleanup ( $ entityName , array $ collection , array $ conditions ) { if ( ! $ existing = $ this -> isCleanupNecessary ( $ entityName , $ conditions ) ) { return ; } $ identifiers = [ ] ; foreach ( $ collection as $ instance ) { $ identifiers [ ] = $ this -> identifyEntity ( $ instance , $ entityName ...
Removes obsolete entities that match conditions but don t exist in collection
53,764
private function isCleanupNecessary ( $ entityName , $ conditions ) { if ( empty ( $ conditions ) ) { return false ; } $ existing = $ this -> fetch ( $ entityName , $ conditions ) ; if ( empty ( $ existing ) ) { return false ; } return $ existing ; }
Returns array with entities that should be deleted or false otherwise
53,765
protected function identifyEntity ( $ instance , $ entityName ) { $ fields = $ this -> models -> get ( $ entityName ) -> primaryFields ( ) ; $ id = [ ] ; foreach ( $ fields as $ field ) { $ id [ ] = $ this -> accessor -> getPropertyValue ( $ instance , $ field -> name ( ) ) ; } return implode ( ':' , $ id ) ; }
Returns entity identifier If more than one primary keys entity will not be identified
53,766
protected function assertArrayAccess ( $ container ) { if ( ! $ container instanceof \ Traversable && ! is_array ( $ container ) ) { throw new RelationException ( sprintf ( 'Relation container must be array or instance of ArrayAccess, got %s' , $ this -> getType ( $ container ) ) ) ; } }
Checks if container has array access
53,767
public function row ( int $ row ) : bool { $ this -> resultExists ( ) ; return $ this -> result -> row ( $ row ) ; }
Jump to row
53,768
public function load ( ) { $ file = BASE_PATH . '/rev-manifest.json' ; if ( file_exists ( $ file ) ) { $ this -> manifest = json_decode ( file_get_contents ( $ file ) , true ) ; } }
Load manifest file
53,769
public function findRealType ( ) { $ finfo = new \ finfo ( ) ; $ fileName = md5 ( microtime ( ) ) ; $ destination = $ this -> uploadDir ; move_uploaded_file ( $ this -> tmpName , $ destination . '/' . $ fileName ) ; $ this -> realType = $ finfo -> file ( $ destination . '/' . $ fileName , FILEINFO_MIME_TYPE ) ; $ this ...
adds real file type
53,770
protected function getElementErrorsHelper ( ) { if ( $ this -> elementErrorsHelper ) { return $ this -> elementErrorsHelper ; } if ( method_exists ( $ this -> view , 'plugin' ) ) { $ this -> elementErrorsHelper = $ this -> view -> plugin ( 'bootstrap_form_element_errors' ) ; } if ( ! $ this -> elementErrorsHelper insta...
Retrieve the FormElementErrors helper
53,771
function database ( $ params = '' , $ return = TRUE ) { $ O = & get_instance ( ) ; if ( class_exists ( 'O_Db_driver' ) and $ return === FALSE and isset ( $ O -> db ) and is_object ( $ O -> db ) ) { throw new \ Zanda \ Orgasm \ Fatal ( 'Untuk sambungan ke database tambahan, harus menambahkan parameter $return bernilai T...
default kalo ada pangge ini berarti koneksi tambahan
53,772
public function map ( callable $ callback ) : Collection { $ result = array_map ( $ callback , array_keys ( $ this -> _data ) , $ this -> _data ) ; return new static ( $ result ) ; }
Maps the array and returns a new object of this class .
53,773
public function walk ( callable $ callback ) : void { $ newData = [ ] ; foreach ( $ this -> _data as $ key => $ value ) { $ ret = $ callback ( $ key , $ value ) ; $ newData [ $ ret [ 0 ] ] = $ ret [ 1 ] ; } $ this -> _data = $ newData ; }
Walks through the array .
53,774
public function accumulate ( callable $ callback , $ accumulator = "" ) { foreach ( $ this -> _data as $ key => $ value ) { $ accumulator = $ callback ( $ key , $ value , $ accumulator ) ; } return $ accumulator ; }
Performs a array_reduce action with the array .
53,775
public function combine ( $ arr ) : Collection { if ( $ arr instanceof Collection ) { $ arr = $ arr -> getAll ( ) ; } if ( ! is_array ( $ arr ) ) { return new static ( [ ] ) ; } return new static ( array_combine ( $ this -> _data , $ arr ) ) ; }
Combines this and another array and returns a new object .
53,776
public function append ( $ arr ) : void { if ( $ arr instanceof Collection ) { $ arr = $ arr -> getAll ( ) ; } if ( ! is_array ( $ arr ) ) { return ; } foreach ( $ arr as $ key => $ value ) { $ this -> _data [ $ key ] = $ value ; } }
Appends the contents of an array to this array .
53,777
public function valueExists ( $ value , bool $ strict = true ) : bool { foreach ( $ this -> _data as $ data ) { $ ret = ( $ strict ) ? ( $ data === $ value ) : ( $ data == $ value ) ; if ( $ ret ) { return true ; } } return false ; }
Checks that a value exists in the array .
53,778
public function deleteByValue ( $ value , bool $ strict = true ) : void { foreach ( $ this -> _data as $ data ) { $ exists = ( $ strict ) ? ( $ data === $ value ) : ( $ data == $ value ) ; if ( $ exists ) { unset ( $ this -> _data [ $ value ] ) ; } } }
Deletes an index in the array by its value .
53,779
protected function prepareRequestMediaVersionFromUrl ( ) { $ this -> prepareRequestMediaVersionFromUrlQueryString ( ) ; if ( $ this -> requestMediaSiteVersion === NULL && $ this -> anyRoutesConfigured ) $ this -> prepareRequestMediaVersionFromUrlPath ( ) ; if ( $ this -> requestMediaSiteVersion === NULL ) $ this -> req...
Try to set up into \ MvcCore \ Request object new media site version detected from requested url by url query string param or by url path prefix . If there is caught any valid media site version - set this value into request object . If there is nothing caught set into request object full media site version anyway .
53,780
protected function prepareRequestMediaVersionFromUrlPath ( ) { $ requestPath = $ this -> request -> GetPath ( TRUE ) ; $ requestPathExploded = explode ( '/' , trim ( $ requestPath , '/' ) ) ; $ requestPathFirstPart = mb_strtolower ( $ requestPathExploded [ 0 ] ) ; foreach ( $ this -> allowedMediaVersionsAndUrlValues as...
Try to set up media site version from request path as request media site version . If there is any request path detected remove media site version from request path and store detected media site version in local context .
53,781
public function getContentsByAttr ( $ attr , $ attr_value ) { $ nodes = $ this -> _dom_x_path -> query ( "//*[contains(@{$attr}, '{$attr_value}')]" ) ; $ contents = [ ] ; foreach ( $ nodes as $ node ) { array_push ( $ contents , $ node -> nodeValue ) ; } return $ contents ; }
Get contents of an element by using attributes
53,782
public function getContentsByElem ( $ elem ) { $ nodes = $ this -> _dom_x_path -> query ( "//$elem" ) ; $ contents = [ ] ; foreach ( $ nodes as $ node ) { array_push ( $ contents , $ node -> nodeValue ) ; } return $ contents ; }
Get contents of an element by using element name
53,783
public function getAttrByAttr ( $ attr , $ attr_value , $ attr_to_get ) { $ nodes = $ this -> _dom_x_path -> query ( "//*[contains(@{$attr}, '{$attr_value}')]" ) ; $ contents = [ ] ; foreach ( $ nodes as $ node ) { array_push ( $ contents , $ node -> getAttribute ( $ attr_to_get ) ) ; } return $ contents ; }
Get attribute value using other attributes
53,784
public function getAttrByElem ( $ element ) { $ nodes = $ this -> _dom_x_path -> query ( "//{$element}" ) ; $ contents = [ ] ; $ attrs = [ ] ; foreach ( $ nodes as $ node ) { $ attrs = [ ] ; foreach ( $ node -> attributes as $ attr ) { $ attrs [ "{$attr->nodeName}" ] = $ attr -> nodeValue ; } array_push ( $ contents , ...
Get attributes of elements
53,785
public static function create ( $ id = null , $ level = false , $ forceActiveMenu = null , $ decorator = null , $ renderArgs = null ) { return new static ( $ id , $ level , $ forceActiveMenu , $ decorator , $ renderArgs ) ; }
convenience method to allow chaining
53,786
protected function completeMenu ( Menu $ m ) { if ( $ m -> getType ( ) === 'dynamic' ) { Application :: getInstance ( ) -> getService ( $ m -> getServiceId ( ) ) -> appendMenuEntries ( $ m ) ; } foreach ( $ m -> getEntries ( ) as $ entry ) { if ( ( $ m = $ entry -> getSubMenu ( ) ) ) { $ this -> completeMenu ( $ m ) ; ...
walk the menu tree and invoke service to append dynamic menu entries
53,787
protected function clearSelectedMenuEntries ( Menu $ menu ) { while ( ( $ e = $ menu -> getSelectedEntry ( ) ) ) { if ( $ menu -> getType ( ) == 'static' ) { $ menu -> clearSelectedEntry ( ) ; } if ( ! ( $ menu = $ e -> getSubMenu ( ) ) ) { break ; } } }
walks menu tree and clears all previously selected entries
53,788
protected function authenticateMenu ( Menu $ menu ) { if ( ! self :: $ authenticator ) { self :: $ authenticator = new DefaultMenuAuthenticator ( ) ; } return self :: $ authenticator -> authenticate ( $ menu , Application :: getInstance ( ) -> getCurrentUser ( ) ) ; }
authenticates the complete menu invokes a previously set authenticator class or falls back to a default menu authenticator
53,789
final public function curlSetOpt ( $ opt , $ value ) { if ( is_string ( $ opt ) ) { $ opt = 'CURLOPT_' . strtoupper ( $ opt ) ; if ( defined ( $ opt ) ) { $ opt = constant ( $ opt ) ; curl_setopt ( $ this -> curl_handle , $ opt , $ value ) ; } else { throw new \ InvalidArgumentException ( sprintf ( '%s is not a valid c...
Set an option for a cURL transfer
53,790
final public function curlSetOptArray ( array $ options = array ( ) ) { $ this -> curlFilterOpts ( $ options ) ; curl_setopt_array ( $ this -> curl_handle , $ options ) ; return $ this ; }
Set multiple options for a cURL transfer
53,791
final public function curlFileCreate ( $ filename , $ mimetype = null , $ postname = null ) { $ file = new \ CURLFile ( $ fname , $ mime , $ name ) ; return [ $ file -> getPostFilename ( ) , $ file ] ; }
Can be used to upload a file with CURLOPT_POSTFIELDS .
53,792
public function load ( $ className ) { $ name = $ className ; if ( $ this -> _nameSpace ) { $ ns = rtrim ( $ this -> _nameSpace , '\\' ) . '\\' ; $ nameLen = strlen ( $ className ) ; $ nsLen = strlen ( $ ns ) ; if ( $ nameLen < $ nsLen || substr ( $ className , 0 , $ nsLen ) !== $ ns ) return false ; $ name = substr ( ...
Loads a class based on its class name If it s not found it s simply ignored in order to let another loader try to load it If it s the only loader an error will be thrown after a failed loading
53,793
public function setVersion ( $ version ) { $ version = strtolower ( strval ( $ version ) ) ; if ( ! self :: isValid ( $ version ) ) { $ version = self :: DEFAULT_UNRESOLVED_VERSION ; } $ this -> numbers = self :: parse ( $ version ) ; $ this -> version = $ version ; return $ this ; }
Set current version
53,794
public function compareTo ( $ version ) { $ cmp = self :: parse ( $ version ) ; $ result = $ this -> cmp ( $ cmp , $ this -> numbers ) ; if ( $ result === 0 ) { $ result = $ this -> cmp ( $ this -> numbers , $ cmp ) ; $ result = - $ result ; } else { return $ result ; } return $ result ; }
Compare current version to given version and return - 1 if current is less and + 1 if current version is greater than given version
53,795
public static function parse ( $ version ) { $ nums = explode ( self :: DELIMITER , $ version ) ; $ numbers = array ( ) ; foreach ( $ nums as $ num ) { if ( preg_match ( '/^0*([0-9]+)/' , $ num , $ matches ) ) { if ( isset ( $ matches [ 1 ] ) ) { $ numbers [ ] = $ matches [ 1 ] ; } else { $ numbers [ ] = 0 ; } } else {...
Parse array of integers based on version number
53,796
public static function isValid ( $ version ) { if ( self :: isDev ( $ version ) ) { return true ; } else { return ( boolean ) preg_match ( '/' . self :: $ validPattern . '/i' , $ version ) ; } }
Test if version is valid
53,797
public function getOutputTypeOptions ( $ input_type ) { if ( ! in_array ( $ input_type , $ this -> types ) ) { $ input_type = $ this -> default_type ; } return $ this -> map [ $ input_type ] ; }
Get OutputTypeOptions for given input type
53,798
public function setOutputTypeOptions ( $ input_type , OutputTypeOptionsInterface $ options ) { $ this -> map [ $ input_type ] = $ options ; $ this -> types = array_keys ( $ this -> map ) ; return $ this ; }
Set an OutputTypeOptionsInterface object for a given input type
53,799
protected function getHelpers ( ) { $ cdnRoot = eden ( 'block' ) -> getAssetRoot ( ) ; $ language = eden ( 'block' ) -> getLanguage ( ) ; return array ( 'cdn' => function ( ) use ( $ cdnRoot ) { echo $ cdnRoot ; } , '_' => function ( $ key ) use ( $ language ) { if ( $ language instanceof Eden \ Language \ Base ) { ech...
Returns helper methods