idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
6,400
protected function resolve ( string $ abstract , array & $ stack = [ ] ) : Dependency { if ( isset ( $ this -> aliases [ $ abstract ] ) ) { $ alias = $ this -> aliases [ $ abstract ] ; if ( in_array ( $ alias , $ stack ) ) { $ stack [ ] = $ alias ; $ error = implode ( ' => ' , $ stack ) ; throw new BindingException ( "Circular reference detected: $error" ) ; } else { $ stack [ ] = $ alias ; return $ this -> resolve ( $ alias , $ stack ) ; } } if ( ! isset ( $ this -> bindings [ $ abstract ] ) ) { $ this -> bind ( $ abstract , null ) ; } return $ this -> bindings [ $ abstract ] ; }
Resolves an abstract type
6,401
protected function build ( $ concrete , array $ arguments = [ ] ) { if ( is_callable ( $ concrete ) ) { return $ concrete ( $ this , $ arguments ) ; } if ( isset ( $ this -> reflectionClass [ $ concrete ] ) ) { $ reflection = $ this -> reflectionClass [ $ concrete ] ; } else { try { $ reflection = $ this -> reflectionClass [ $ concrete ] = new ReflectionClass ( $ concrete ) ; } catch ( \ ReflectionException $ e ) { throw new BindingException ( 'ReflectionException: ' . $ e -> getMessage ( ) ) ; } } if ( ! $ reflection -> isInstantiable ( ) ) { throw new BindingException ( "The '${concrete}' type is not instantiable" ) ; } if ( isset ( $ this -> reflectionMethod [ $ concrete ] ) ) { $ constructor = $ this -> reflectionMethod [ $ concrete ] ; } else { $ constructor = $ this -> reflectionMethod [ $ concrete ] = $ reflection -> getConstructor ( ) ; } if ( is_null ( $ constructor ) ) { return new $ concrete ( ) ; } $ parameters = array_diff_key ( $ constructor -> getParameters ( ) , $ arguments ) ; foreach ( $ parameters as $ key => $ parameter ) { if ( null === $ class = $ parameter -> getClass ( ) ) { if ( $ parameter -> isDefaultValueAvailable ( ) ) { $ arguments [ $ key ] = $ parameter -> getDefaultValue ( ) ; } else { throw new BindingException ( "Could not resolve [$parameter]" ) ; } continue ; } try { $ class = $ class -> name ; $ arguments [ $ key ] = isset ( $ this -> bindings [ $ class ] ) ? $ this -> make ( $ class ) : $ this -> build ( $ class ) ; } catch ( BindingException $ e ) { if ( ! $ parameter -> isOptional ( ) ) { throw $ e ; } $ arguments [ $ key ] = $ parameter -> getDefaultValue ( ) ; } } ksort ( $ arguments ) ; return $ reflection -> newInstanceArgs ( $ arguments ) ; }
Builds an instance of a concrete type
6,402
public function parse ( ) { return $ this -> execute ( Util :: cache ( $ this -> file , $ this -> raw , 'viper' , function ( $ data ) : NodeCollection { $ tokens = $ this -> tokenize ( $ data ) ; return $ this -> formLogicalTree ( $ tokens ) ; } ) , $ this -> data ) ; }
Chief executive viper function
6,403
public function factory ( $ collection ) { if ( $ collection instanceof Collection ) { $ collectionName = $ collection -> getName ( ) ; } else { $ collectionName = $ collection ; } if ( ! isset ( $ this -> collections [ $ collectionName ] ) ) { if ( ! ( $ collection instanceof Collection ) ) { $ collection = Norm :: createCollection ( array ( 'name' => $ collection , 'connection' => $ this , ) ) ; $ this -> applyHook ( 'norm.after.factory' , $ collection ) ; } $ this -> collections [ $ collectionName ] = $ collection ; } return $ this -> collections [ $ collectionName ] ; }
Factory to create new collection by its name or instance
6,404
public function unmarshall ( $ object ) { if ( isset ( $ object [ 'id' ] ) ) { $ object [ '$id' ] = $ object [ 'id' ] ; unset ( $ object [ 'id' ] ) ; } foreach ( $ object as $ key => $ value ) { if ( $ key [ 0 ] === '_' ) { $ key [ 0 ] = '$' ; $ object [ $ key ] = $ value ; } } return $ object ; }
Unmarshall single object from data source to associative array . The unmarshall process is necessary due to different data type provided by data source . Proper unmarshall will make sure data from data source that will be consumed by Norm in the accepted form of data .
6,405
public function delete ( ) { $ deleteUri = $ this -> link ( 'edit' ) ; if ( ! $ deleteUri ) { require_once 'Zend/Feed/Exception.php' ; throw new Zend_Feed_Exception ( 'Cannot delete entry; no link rel="edit" is present.' ) ; } $ client = Zend_Feed :: getHttpClient ( ) ; do { $ client -> setUri ( $ deleteUri ) ; if ( Zend_Feed :: getHttpMethodOverride ( ) ) { $ client -> setHeader ( 'X-HTTP-Method-Override' , 'DELETE' ) ; $ response = $ client -> request ( 'POST' ) ; } else { $ response = $ client -> request ( 'DELETE' ) ; } $ httpStatus = $ response -> getStatus ( ) ; switch ( ( int ) $ httpStatus / 100 ) { case 2 : return true ; case 3 : $ deleteUri = $ response -> getHeader ( 'Location' ) ; continue ; default : require_once 'Zend/Feed/Exception.php' ; throw new Zend_Feed_Exception ( "Expected response code 2xx, got $httpStatus" ) ; } } while ( true ) ; }
Delete an atom entry .
6,406
public function initItems ( ) { if ( ! empty ( $ this -> items ) ) { $ links = array ( ) ; if ( $ this -> homeLabel !== false ) { $ label = $ this -> homeLabel !== null ? $ this -> homeLabel : Icon :: icon ( Enum :: ICON_HOME ) ; $ links [ $ label ] = array ( 'href' => $ this -> homeUrl !== null ? $ this -> homeUrl : \ Yii :: app ( ) -> homeUrl ) ; } foreach ( $ this -> items as $ label => $ options ) { if ( is_string ( $ label ) ) { if ( $ this -> encodeLabel ) $ label = \ CHtml :: encode ( $ label ) ; if ( is_string ( $ options ) ) $ links [ $ label ] = array ( 'href' => \ CHtml :: normalizeUrl ( $ options ) ) ; else { $ url = ArrayHelper :: removeValue ( $ options , 'url' , '' ) ; $ options [ 'href' ] = \ CHtml :: normalizeUrl ( $ url ) ; $ links [ $ label ] = $ options ; } } else $ links [ $ options ] = array ( 'href' => '#' ) ; } $ this -> items = $ links ; } }
Initializes menu items
6,407
public function renderItem ( $ label , $ options = array ( ) ) { if ( $ this -> tagName === 'nav' ) { $ url = ArrayHelper :: removeValue ( $ options , 'href' , '#' ) ; $ htmlOptions = ArrayHelper :: removeValue ( $ options , 'options' , array ( ) ) ; echo \ CHtml :: openTag ( 'li' , $ htmlOptions ) ; echo \ CHtml :: link ( $ label , $ url ) ; echo \ CHtml :: closeTag ( 'li' ) ; } else { $ htmlOptions = ArrayHelper :: removeValue ( $ options , 'options' , array ( ) ) ; echo \ CHtml :: tag ( 'a' , array_merge ( $ htmlOptions , $ options ) , $ label ) ; } }
Generates the rendering of a breadcrumb item
6,408
static public function strToSlug ( $ string , $ bWithSlashes = true ) { switch ( $ GLOBALS [ 'okt' ] -> config -> slug_type ) { case 'utf8' : return self :: tidyURL ( $ string , $ bWithSlashes ) ; case 'ascii' : default : return self :: strToLowerURL ( $ string , $ bWithSlashes ) ; } }
Transform a string in slug regarding to Okatea configuration .
6,409
public static function strToUrl ( $ string , $ bWithSlashes = true ) { $ string = self :: deaccent ( $ string ) ; $ string = preg_replace ( '/[^A-Za-z0-9_\s\'\:\/[\]-]/' , '' , $ string ) ; return self :: tidyUrl ( $ string , $ bWithSlashes ) ; }
String to URL
6,410
static public function strToCamelCase ( $ string ) { $ string = self :: strToLowerUrl ( $ string , false ) ; $ string = implode ( '' , array_map ( 'ucfirst' , explode ( '_' , $ string ) ) ) ; $ string = implode ( '' , array_map ( 'ucfirst' , explode ( '-' , $ string ) ) ) ; return strtolower ( substr ( $ string , 0 , 1 ) ) . substr ( $ string , 1 ) ; }
Transform a string in a camelCase style .
6,411
public static function deaccent ( $ string ) { $ pattern = [ ] ; $ pattern [ 'A' ] = '\x{00C0}-\x{00C5}' ; $ pattern [ 'AE' ] = '\x{00C6}' ; $ pattern [ 'C' ] = '\x{00C7}' ; $ pattern [ 'D' ] = '\x{00D0}' ; $ pattern [ 'E' ] = '\x{00C8}-\x{00CB}' ; $ pattern [ 'I' ] = '\x{00CC}-\x{00CF}' ; $ pattern [ 'N' ] = '\x{00D1}' ; $ pattern [ 'O' ] = '\x{00D2}-\x{00D6}\x{00D8}' ; $ pattern [ 'OE' ] = '\x{0152}' ; $ pattern [ 'S' ] = '\x{0160}' ; $ pattern [ 'U' ] = '\x{00D9}-\x{00DC}' ; $ pattern [ 'Y' ] = '\x{00DD}' ; $ pattern [ 'Z' ] = '\x{017D}' ; $ pattern [ 'a' ] = '\x{00E0}-\x{00E5}' ; $ pattern [ 'ae' ] = '\x{00E6}' ; $ pattern [ 'c' ] = '\x{00E7}' ; $ pattern [ 'd' ] = '\x{00F0}' ; $ pattern [ 'e' ] = '\x{00E8}-\x{00EB}' ; $ pattern [ 'i' ] = '\x{00EC}-\x{00EF}' ; $ pattern [ 'n' ] = '\x{00F1}' ; $ pattern [ 'o' ] = '\x{00F2}-\x{00F6}\x{00F8}' ; $ pattern [ 'oe' ] = '\x{0153}' ; $ pattern [ 's' ] = '\x{0161}' ; $ pattern [ 'u' ] = '\x{00F9}-\x{00FC}' ; $ pattern [ 'y' ] = '\x{00FD}\x{00FF}' ; $ pattern [ 'z' ] = '\x{017E}' ; $ pattern [ 'ss' ] = '\x{00DF}' ; foreach ( $ pattern as $ r => $ p ) { $ string = preg_replace ( '/[' . $ p . ']/u' , $ r , $ string ) ; } return $ string ; }
Accents replacement .
6,412
public static function tidyUrl ( $ string , $ bKeepSlashes = true , $ bKeepSpaces = false ) { $ string = strip_tags ( $ string ) ; $ string = str_replace ( [ '?' , '&' , '#' , '=' , '+' , '<' , '>' , '"' , '%' ] , '' , $ string ) ; $ string = str_replace ( "'" , ' ' , $ string ) ; $ string = preg_replace ( '/[\s]+/u' , ' ' , trim ( $ string ) ) ; if ( ! $ bKeepSlashes ) { $ string = str_replace ( '/' , '-' , $ string ) ; } if ( ! $ bKeepSpaces ) { $ string = str_replace ( ' ' , '-' , $ string ) ; } $ string = preg_replace ( '/[-]+/' , '-' , $ string ) ; $ string = preg_replace ( '%^/%' , '' , $ string ) ; $ string = preg_replace ( '%\.+/%' , '' , $ string ) ; return $ string ; }
URL cleanup .
6,413
public static function init ( $ config , $ collectionConfig = array ( ) ) { $ first = null ; static :: $ collectionConfig = $ collectionConfig ; if ( empty ( $ config ) ) { return ; } foreach ( $ config as $ key => $ value ) { $ value [ 'name' ] = $ key ; if ( ! isset ( $ value [ 'driver' ] ) ) { throw new Exception ( '[Norm] Cannot instantiate connection "' . $ key . '", Driver "' . @ $ value [ 'driver' ] . '" not found!' ) ; } $ Driver = $ value [ 'driver' ] ; static :: $ connections [ $ key ] = new $ Driver ( $ value ) ; if ( ! static :: $ connections [ $ key ] instanceof Connection ) { throw new Exception ( 'Norm connection [' . $ key . '] should be instance of Connection' ) ; } if ( ! $ first ) { $ first = $ key ; } } if ( ! static :: $ defaultConnection ) { static :: $ defaultConnection = $ first ; } }
Initialize framework from configuration . First connection registered from config will be the default connection .
6,414
public static function options ( $ key , $ value = ':get:' ) { if ( is_array ( $ key ) ) { foreach ( $ key as $ k => $ v ) { static :: $ options ( $ k , $ v ) ; } return ; } if ( $ value === ':get:' ) { return isset ( static :: $ options [ $ key ] ) ? static :: $ options [ $ key ] : null ; } static :: $ options [ $ key ] = $ value ; }
Get the option of Norm configuration .
6,415
public static function createCollection ( $ options ) { $ defaultConfig = isset ( static :: $ collectionConfig [ 'default' ] ) ? static :: $ collectionConfig [ 'default' ] : array ( ) ; $ config = null ; if ( isset ( static :: $ collectionConfig [ 'mapping' ] [ $ options [ 'name' ] ] ) ) { $ config = static :: $ collectionConfig [ 'mapping' ] [ $ options [ 'name' ] ] ; } else { if ( isset ( static :: $ collectionConfig [ 'resolvers' ] ) and is_array ( static :: $ collectionConfig [ 'resolvers' ] ) ) { foreach ( static :: $ collectionConfig [ 'resolvers' ] as $ resolver => $ resolverOpts ) { if ( is_string ( $ resolverOpts ) ) { $ resolver = $ resolverOpts ; $ resolverOpts = array ( ) ; } $ resolver = new $ resolver ( $ resolverOpts ) ; $ config = $ resolver -> resolve ( $ options ) ; if ( isset ( $ config ) ) { break ; } } } } if ( ! isset ( $ config ) ) { $ config = array ( ) ; } $ config = array_merge_recursive ( $ defaultConfig , $ config ) ; $ options = array_merge_recursive ( $ config , $ options ) ; if ( isset ( $ options [ 'collection' ] ) ) { $ Driver = $ options [ 'collection' ] ; $ collection = new $ Driver ( $ options ) ; } else { $ collection = new Collection ( $ options ) ; } return $ collection ; }
Create collection by configuration .
6,416
public static function getConnection ( $ connectionName = '' ) { if ( ! $ connectionName ) { $ connectionName = static :: $ defaultConnection ; } if ( isset ( static :: $ connections [ $ connectionName ] ) ) { return static :: $ connections [ $ connectionName ] ; } }
Get connection by its connection name if no connection name provided then the function will return default connection .
6,417
public static function ensureArrayKeys ( $ key ) { if ( empty ( $ key ) ) { return array ( ) ; } if ( ! is_array ( $ key ) ) { if ( strstr ( $ key , '|' ) ) { $ key = str_replace ( '|' , self :: ARRAY_DELIMITER , $ key ) ; } $ key = explode ( self :: ARRAY_DELIMITER , $ key ) ; } return $ key ; }
Converts string keys to array keys .
6,418
public static function flattenData ( array $ data , $ prefix = NULL , $ label = array ( ) ) { $ flattened_data = array ( ) ; if ( isset ( $ data [ '#label' ] ) ) { $ label [ ] = $ data [ '#label' ] ; } if ( ! empty ( $ data [ '#text' ] ) ) { $ flattened_data [ $ prefix ] = $ data ; $ flattened_data [ $ prefix ] [ '#parent_label' ] = $ label ; } else { $ prefix = isset ( $ prefix ) ? $ prefix . self :: ARRAY_DELIMITER : '' ; foreach ( self :: elementChildren ( $ data ) as $ key ) { $ flattened_data += self :: flattenData ( $ data [ $ key ] , $ prefix . $ key , $ label ) ; } } return $ flattened_data ; }
Converts a nested data array into a flattened structure with a combined key .
6,419
public static function unflattenData ( $ flattened_data ) { $ data = array ( ) ; foreach ( $ flattened_data as $ key => $ flattened_data_entry ) { self :: arraySetNestedValue ( $ data , explode ( self :: ARRAY_DELIMITER , $ key ) , $ flattened_data_entry ) ; } return $ data ; }
Converts a flattened data structure into a nested array .
6,420
public static function elementChildren ( $ elements ) { $ children = array ( ) ; foreach ( $ elements as $ key => $ value ) { if ( $ key === '' || $ key [ 0 ] !== '#' ) { $ children [ $ key ] = $ value ; } } return array_keys ( $ children ) ; }
Identifies the children of an element array .
6,421
public static function evaluate ( $ number , array $ rules ) { $ rules = self :: compile ( $ rules ) ; return self :: evaluateCompiled ( $ number , $ rules ) ; }
Evaluate a number against a set of plural rules . If a rule passes return the index of plural rule .
6,422
public static function compile ( array $ rules ) { foreach ( $ rules as & $ rule ) { $ rule = Converter :: convert ( $ rule ) ; } return $ rules ; }
Convert a set of rules to a compiled form which is optimised for fast evaluation . The result will be an array of strings and may be cached .
6,423
private static function doOperation ( $ token , $ left , $ right ) { if ( in_array ( $ token , [ 'in' , 'not-in' , 'within' , 'not-within' ] ) ) { if ( ! $ right instanceof Range ) { $ right = new Range ( $ right ) ; } } switch ( $ token ) { case 'or' : return $ left || $ right ; case 'and' : return $ left && $ right ; case 'is' : return $ left == $ right ; case 'is-not' : return $ left != $ right ; case 'in' : return $ right -> isNumberIn ( $ left ) ; case 'not-in' : return ! $ right -> isNumberIn ( $ left ) ; case 'within' : return $ right -> isNumberWithin ( $ left ) ; case 'not-within' : return ! $ right -> isNumberWithin ( $ left ) ; case 'mod' : if ( is_int ( $ left ) ) { return ( int ) fmod ( $ left , $ right ) ; } return fmod ( $ left , $ right ) ; case ',' : if ( $ left instanceof Range ) { $ range = $ left ; } else { $ range = new Range ( $ left ) ; } $ range -> add ( $ right ) ; return $ range ; case '..' : return new Range ( $ left , $ right ) ; default : throw new Error ( "Invalid RPN token" ) ; } }
Do a single operation
6,424
public function setForm ( $ form ) { $ this -> honeypot -> setForm ( $ form ) ; $ this -> timestamp -> setForm ( $ form ) ; return parent :: setForm ( $ form ) ; }
Defines the form instance for the receiver .
6,425
public function Field ( $ properties = [ ] ) { Requirements :: customCSS ( '.field.simpleguard { display: none !important; }' ) ; return DBField :: create_field ( 'HTMLFragment' , $ this -> honeypot -> Field ( ) . $ this -> timestamp -> Field ( ) ) ; }
Renders the field for the template .
6,426
public function setValue ( $ value , $ data = null ) { if ( is_array ( $ value ) ) { $ this -> honeypot -> setValue ( isset ( $ value [ 'value' ] ) ? $ value [ 'value' ] : null ) ; $ this -> timestamp -> setValue ( isset ( $ value [ 'timestamp' ] ) ? $ value [ 'timestamp' ] : null ) ; $ this -> value = $ this -> honeypot -> dataValue ( ) ; } return $ this ; }
Defines the field value .
6,427
public function validate ( $ validator ) { if ( ! empty ( $ this -> value ) || $ this -> tooSoon ( ) ) { $ validator -> validationError ( $ this -> name , _t ( __CLASS__ . '.VALIDATIONERROR' , 'Sorry, an error has occurred. Please try again later.' ) , 'validation' ) ; return false ; } return true ; }
Answers true if the value is valid for the receiver .
6,428
public function getRequestVars ( $ name , $ primaryKey = self :: PRIMARY_KEY ) { $ name = Str :: low ( Inflector :: singularize ( $ name ) ) ; $ requestIds = ( array ) $ this -> _request -> getData ( $ name ) ; $ action = $ this -> _request -> getData ( 'action' ) ; $ ids = $ this -> _getIds ( $ requestIds , $ primaryKey ) ; return [ $ action , $ ids ] ; }
Get actual request vars for process .
6,429
public function make ( Table $ table , $ action , array $ ids = [ ] , array $ options = [ ] ) { $ count = count ( $ ids ) ; $ options = $ this -> _getOptions ( $ options , $ count ) ; $ redirectUrl = $ options [ 'redirect' ] ; $ messages = new JSON ( $ options [ 'messages' ] ) ; $ event = EventManager :: trigger ( $ this -> _getEventName ( $ action ) , $ this -> _controller , [ 'ids' => $ ids ] ) ; $ ids = ( array ) $ event -> getData ( 'ids' ) ; $ count = count ( $ ids ) ; if ( ! $ action ) { $ this -> Flash -> error ( $ messages -> get ( 'no_action' ) ) ; return $ this -> _controller -> redirect ( $ redirectUrl ) ; } if ( $ count <= 0 ) { $ this -> Flash -> error ( $ messages -> get ( 'no_choose' ) ) ; return $ this -> _controller -> redirect ( $ redirectUrl ) ; } $ this -> _loadBehavior ( $ table ) ; if ( $ table -> process ( $ action , $ ids ) ) { return $ this -> _process ( $ action , $ messages , $ redirectUrl , $ ids ) ; } $ this -> Flash -> error ( __d ( 'core' , 'An error has occurred. Please try again.' ) ) ; return $ this -> _controller -> redirect ( $ redirectUrl ) ; }
Make process .
6,430
protected function _getDefaultMessages ( $ count ) { $ context = $ this -> _configRead ( 'context' ) ; $ contextPlural = Inflector :: pluralize ( $ context ) ; $ countString = sprintf ( '<strong>%s</strong>' , $ count ) ; return [ 'delete' => __dn ( 'core' , 'One ' . $ context . ' success removed' , '{0} ' . $ contextPlural . ' success removed' , $ count , $ countString ) , 'publish' => __dn ( 'core' , 'One ' . $ context . ' success publish' , '{0} ' . $ contextPlural . ' success published' , $ count , $ countString ) , 'unpublish' => __dn ( 'core' , 'One ' . $ context . ' success unpublish' , '{0} ' . $ contextPlural . ' success unpublished' , $ count , $ countString ) , ] ; }
Setup default action messages .
6,431
protected function _getEventName ( $ action , $ event = self :: EVENT_NAME_BEFORE ) { $ details = [ ] ; if ( $ prefix = $ this -> _request -> getParam ( 'prefix' ) ) { $ details [ ] = ucfirst ( $ prefix ) ; } $ details = Hash :: merge ( $ details , [ 'Controller' , $ this -> _controller -> getName ( ) , $ event . Inflector :: camelize ( $ action ) , 'Process' , ] ) ; return implode ( '.' , $ details ) ; }
Get event name by data .
6,432
protected function _getIds ( array $ ids , $ primaryKey = self :: PRIMARY_KEY ) { $ return = [ ] ; foreach ( $ ids as $ id => $ value ) { if ( is_array ( $ value ) && is_int ( $ id ) && ( int ) $ value [ $ primaryKey ] === 1 ) { $ return [ $ id ] = $ id ; } } return $ return ; }
Get ids by request .
6,433
protected function _getOptions ( array $ options , $ count ) { $ options = Hash :: merge ( $ this -> _config , $ options ) ; return Hash :: merge ( [ 'messages' => $ this -> _getDefaultMessages ( $ count ) ] , $ options ) ; }
Create and merge actual process options .
6,434
protected function _loadBehavior ( Table $ table ) { $ behaviors = $ table -> behaviors ( ) ; if ( ! Arr :: in ( 'Process' , $ behaviors -> loaded ( ) ) ) { $ behaviors -> load ( 'Core.Process' ) ; } }
Load process behavior .
6,435
protected function _process ( $ action , Data $ messages , array $ redirect , array $ ids ) { $ count = count ( $ ids ) ; $ defaultMsg = __dn ( 'core' , 'One record success processed' , '{0} records processed' , $ count , sprintf ( '<strong>%s</strong>' , $ count ) ) ; EventManager :: trigger ( $ this -> _getEventName ( $ action , self :: EVENT_NAME_AFTER ) , $ this -> _controller , [ 'ids' => $ ids ] ) ; $ this -> Flash -> success ( $ messages -> get ( $ action , $ defaultMsg ) ) ; return $ this -> _controller -> redirect ( $ redirect ) ; }
Controller process .
6,436
public function getQueueMonitor ( ) : ? Monitor { if ( ! $ this -> hasQueueMonitor ( ) ) { $ this -> setQueueMonitor ( $ this -> getDefaultQueueMonitor ( ) ) ; } return $ this -> queueMonitor ; }
Get queue monitor
6,437
public static function add ( $ key , $ item , & $ arr ) { if ( ! is_array ( $ arr ) ) { throw new \ InvalidArgumentException ( 'CCArr::add - second argument has to be an array.' ) ; } if ( ! is_array ( static :: get ( $ key , $ arr ) ) ) { return static :: set ( $ key , array ( $ item ) , $ arr ) ; } return static :: set ( $ key , static :: push ( $ item , static :: get ( $ key , $ arr ) ) , $ arr ) ; }
Adds an item to an element in the array
6,438
public static function sum ( $ arr , $ key = null ) { if ( ! is_array ( $ arr ) ) { throw new \ InvalidArgumentException ( 'CCArr::sum - first argument has to be an array.' ) ; } $ sum = 0 ; if ( is_string ( $ key ) && CCArr :: is_multi ( $ arr ) ) { $ arr = CCArr :: pick ( $ key , $ arr ) ; } foreach ( $ arr as $ item ) { if ( is_numeric ( $ item ) ) { $ sum += $ item ; } } return $ sum ; }
sum items in an array or use special item in the array
6,439
public static function average ( $ arr , $ key = null ) { if ( ! is_array ( $ arr ) ) { throw new \ InvalidArgumentException ( 'CCArr::average - first argunent has to be an array.' ) ; } if ( is_string ( $ key ) && CCArr :: is_multi ( $ arr ) ) { $ arr = CCArr :: pick ( $ key , $ arr ) ; } return ( static :: sum ( $ arr ) / count ( $ arr ) ) ; }
get the average of the items
6,440
public static function object ( $ arr ) { if ( ! is_array ( $ arr ) ) { throw new \ InvalidArgumentException ( "CCArr::object - only arrays can be passed." ) ; } $ object = new \ stdClass ( ) ; if ( ! empty ( $ arr ) ) { foreach ( $ arr as $ name => $ value ) { if ( is_array ( $ value ) ) { $ value = static :: object ( $ value ) ; } $ object -> $ name = $ value ; } } return $ object ; }
create an object from an array
6,441
public static function merge ( ) { $ arrs = func_get_args ( ) ; $ return = array ( ) ; foreach ( $ arrs as $ arr ) { if ( ! is_array ( $ arr ) ) { throw new \ InvalidArgumentException ( 'CCArr::merge - all arguments have to be arrays.' ) ; } foreach ( $ arr as $ key => $ value ) { if ( array_key_exists ( $ key , $ return ) ) { if ( is_array ( $ value ) && is_array ( $ return [ $ key ] ) ) { $ value = static :: merge ( $ return [ $ key ] , $ value ) ; } } $ return [ $ key ] = $ value ; } } return $ return ; }
merge arrays recursivly together
6,442
public static function get ( $ key , $ arr , $ default = null ) { if ( isset ( $ arr [ $ key ] ) ) { return $ arr [ $ key ] ; } if ( strpos ( $ key , '.' ) !== false ) { $ kp = explode ( '.' , $ key ) ; switch ( count ( $ kp ) ) { case 2 : if ( isset ( $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] ) ) { return $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] ; } break ; case 3 : if ( isset ( $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] [ $ kp [ 2 ] ] ) ) { return $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] [ $ kp [ 2 ] ] ; } break ; case 4 : if ( isset ( $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] [ $ kp [ 2 ] ] [ $ kp [ 3 ] ] ) ) { return $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] [ $ kp [ 2 ] ] [ $ kp [ 3 ] ] ; } break ; default : $ curr = $ arr ; foreach ( $ kp as $ k ) { if ( isset ( $ curr [ $ k ] ) ) { $ curr = $ curr [ $ k ] ; } else { return $ default ; } } return $ curr ; break ; } } return $ default ; }
return an item from an array with dottet dimensions
6,443
public static function has ( $ key , $ arr ) { if ( isset ( $ arr [ $ key ] ) ) { return true ; } if ( strpos ( $ key , '.' ) !== false ) { $ kp = explode ( '.' , $ key ) ; switch ( count ( $ kp ) ) { case 2 : return isset ( $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] ) ; break ; case 3 : return isset ( $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] [ $ kp [ 2 ] ] ) ; break ; case 4 : return isset ( $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] [ $ kp [ 2 ] ] [ $ kp [ 3 ] ] ) ; break ; default : $ curr = $ arr ; foreach ( $ kp as $ k ) { if ( isset ( $ curr [ $ k ] ) ) { $ curr = $ curr [ $ k ] ; } else { return false ; } } return true ; break ; } } return false ; }
checks if the array has an item with dottet dimensions
6,444
public static function set ( $ key , $ value , & $ arr ) { if ( strpos ( $ key , '.' ) === false ) { $ arr [ $ key ] = $ value ; } else { $ kp = explode ( '.' , $ key ) ; switch ( count ( $ kp ) ) { case 2 : $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] = $ value ; break ; case 3 : $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] [ $ kp [ 2 ] ] = $ value ; break ; case 4 : $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] [ $ kp [ 2 ] ] [ $ kp [ 3 ] ] = $ value ; break ; default : $ kp = array_reverse ( $ kp ) ; $ curr = $ value ; foreach ( $ kp as $ k ) { $ curr = array ( $ k => $ curr ) ; } $ arr = static :: merge ( $ arr , $ curr ) ; break ; } } return $ arr ; }
sets an item from an array with dottet dimensions
6,445
public static function delete ( $ key , & $ arr ) { if ( isset ( $ arr [ $ key ] ) ) { unset ( $ arr [ $ key ] ) ; return ; } if ( strpos ( $ key , '.' ) !== false ) { $ kp = explode ( '.' , $ key ) ; switch ( count ( $ kp ) ) { case 2 : unset ( $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] ) ; return ; break ; case 3 : unset ( $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] [ $ kp [ 2 ] ] ) ; return ; break ; case 4 : unset ( $ arr [ $ kp [ 0 ] ] [ $ kp [ 1 ] ] [ $ kp [ 2 ] ] [ $ kp [ 3 ] ] ) ; return ; break ; } } }
deletes an item from an array with dottet dimensions
6,446
public function matchOrderBy ( $ orderByValue , Array $ mappings , Array $ default = array ( ) ) { if ( is_string ( $ orderByValue ) ) { $ orderByValue = array ( $ orderByValue => 'ASC' ) ; } $ orderBy = array ( ) ; if ( is_array ( $ orderByValue ) ) { foreach ( $ orderByValue as $ key => $ sort ) { $ sort = mb_stripos ( $ sort , 'desc' ) !== FALSE ? 'DESC' : 'ASC' ; if ( array_key_exists ( $ key , $ mappings ) ) { $ alias = $ mappings [ $ key ] ? : $ key ; $ orderBy [ $ alias ] = $ sort ; } } } if ( empty ( $ orderBy ) ) { return $ default ; } return $ orderBy ; }
Matches a value as it is meant to be a order by value
6,447
public static function set_custom_library ( $ name , $ custom_class ) { if ( class_exists ( '\\alsvanzelf\\fem\\' . $ name ) == false ) { throw new exception ( 'library does not exist in fem' ) ; } self :: $ custom_libraries [ $ name ] = $ custom_class ; }
set a custom library for usage by other fem libraries use this when extending a fem library without this fem will call the non - extended library in its own calls
6,448
public static function get_library ( $ name ) { if ( class_exists ( '\\alsvanzelf\\fem\\' . $ name ) == false ) { throw new exception ( 'library does not exist in fem' ) ; } if ( isset ( self :: $ custom_libraries [ $ name ] ) ) { return self :: $ custom_libraries [ $ name ] ; } return '\\alsvanzelf\\fem\\' . $ name ; }
get the class name which should be used for a certain fem library used internally to determine whether a custom library has been set returns the fem class name if no custom library is set
6,449
private static function environment ( ) { $ environment = getenv ( 'APP_ENV' ) ? : 'production' ; define ( 'alsvanzelf\fem\ENVIRONMENT' , $ environment ) ; define ( 'alsvanzelf\fem\ROOT_DIR' , realpath ( __DIR__ . '/../../../../' ) . '/' ) ; define ( 'alsvanzelf\fem\ROOT_DIR_APP' , \ alsvanzelf \ fem \ ROOT_DIR . 'application/' ) ; define ( 'alsvanzelf\fem\CLI' , ( strpos ( php_sapi_name ( ) , 'cli' ) !== false || defined ( 'STDIN' ) ) ) ; if ( constant ( '\alsvanzelf\fem\ENVIRONMENT' ) == false ) { echo 'no environment set' ; exit ; } }
environmental check defines environment and root dir
6,450
private static function uncertain ( ) { ini_set ( 'display_startup_errors' , 0 ) ; ini_set ( 'display_errors' , 0 ) ; error_reporting ( 0 ) ; if ( \ alsvanzelf \ fem \ ENVIRONMENT == 'development' ) { ini_set ( 'display_startup_errors' , 1 ) ; ini_set ( 'display_errors' , 1 ) ; error_reporting ( - 1 ) ; } $ error_handler = function ( $ level , $ message , $ file , $ line , $ context ) { throw new \ ErrorException ( $ message , $ code = 0 , $ level , $ file , $ line ) ; } ; set_error_handler ( $ error_handler ) ; }
error handling know when to say what depending on environment and passes errors to exceptions
6,451
private static function secure ( ) { if ( \ alsvanzelf \ fem \ CLI ) { return ; } header_remove ( 'X-Powered-By' ) ; ini_set ( 'session.use_trans_sid' , 0 ) ; ini_set ( 'session.use_only_cookies' , 1 ) ; ini_set ( 'session.cookie_httponly' , 1 ) ; ini_set ( 'session.use_strict_mode' , 1 ) ; ini_set ( 'session.entropy_file' , '/dev/urandom' ) ; }
basic security stops outputting of php header and help against session fixation
6,452
private function warnInsecureSettings ( ) : void { if ( ! self :: $ warnInsecureSettings ) { return ; } if ( ! ini_get ( 'session.use_cookies' ) ) { $ errorMessage = 'The ini setting session.use_cookies should be set to true.' ; throw new InsecureSettingsException ( $ errorMessage ) ; } if ( ! ini_get ( 'session.use_only_cookies' ) ) { $ errorMessage = 'The ini setting session.use_only_cookies should be set to true.' ; throw new InsecureSettingsException ( $ errorMessage ) ; } if ( ini_get ( 'session.use_trans_sid' ) ) { $ errorMessage = 'The ini setting session.use_trans_id should be set to false.' ; throw new InsecureSettingsException ( $ errorMessage ) ; } if ( ! ini_get ( 'session.use_strict_mode' ) ) { $ errorMessage = 'The ini setting session.use_strict_mode should be set to true.' ; throw new InsecureSettingsException ( $ errorMessage ) ; } }
Throws exceptions when insecure INI settings are detected .
6,453
private function handleStrict ( ) : void { if ( ! ini_get ( 'session.use_strict_mode' ) || headers_sent ( ) ) { return ; } $ cookieName = session_name ( ) ; if ( empty ( $ _COOKIE [ $ cookieName ] ) ) { return ; } $ sessionId = $ _COOKIE [ $ cookieName ] ; $ identifier = $ this -> cryptProvider -> makeSessionIdentifier ( $ sessionId ) ; if ( $ this -> storageDriver -> sessionExists ( $ identifier ) ) { return ; } $ newSessionId = session_create_id ( ) ; session_id ( $ newSessionId ) ; }
Rejects arbitrary session ids .
6,454
public function open ( $ savePath , $ sessionName ) : bool { $ sessionId = session_id ( ) ; $ identifier = $ this -> cryptProvider -> makeSessionIdentifier ( $ sessionId ) ; while ( ! $ this -> storageDriver -> lock ( $ identifier ) ) { usleep ( 1000 ) ; } return true ; }
Opens the session .
6,455
public function close ( ) : bool { $ sessionId = session_id ( ) ; $ identifier = $ this -> cryptProvider -> makeSessionIdentifier ( $ sessionId ) ; $ this -> storageDriver -> unlock ( $ identifier ) ; return true ; }
Closes the session
6,456
public function write ( $ sessionId , $ sessionData ) : bool { $ identifier = $ this -> cryptProvider -> makeSessionIdentifier ( $ sessionId ) ; $ content = $ this -> cryptProvider -> encryptSessionData ( $ sessionId , $ sessionData ) ; try { $ this -> storageDriver -> save ( $ identifier , $ content ) ; return true ; } catch ( Exception $ e ) { return false ; } }
Encrypts the session data and saves to the storage ;
6,457
public function gc ( $ maxLife ) : bool { try { $ this -> storageDriver -> clearOld ( $ maxLife * 1000000 ) ; return true ; } catch ( Exception $ e ) { return false ; } }
Removes the expired sessions from the storage .
6,458
public function setCustomer ( Customer $ v = null ) { if ( $ v === null ) { $ this -> setCustomerId ( NULL ) ; } else { $ this -> setCustomerId ( $ v -> getId ( ) ) ; } $ this -> aCustomer = $ v ; if ( $ v !== null ) { $ v -> addUserCustomerRelation ( $ this ) ; } return $ this ; }
Declares an association between this object and a Customer object .
6,459
public function getCustomer ( PropelPDO $ con = null , $ doQuery = true ) { if ( $ this -> aCustomer === null && ( $ this -> customer_id !== null ) && $ doQuery ) { $ this -> aCustomer = CustomerQuery :: create ( ) -> findPk ( $ this -> customer_id , $ con ) ; } return $ this -> aCustomer ; }
Get the associated Customer object
6,460
public static function create ( $ install = true ) { $ instance = new PcntlSignals ( ) ; if ( $ install ) { $ instance -> install ( self :: getDefaultInstalledSignals ( ) ) ; } return $ instance ; }
Factory method can install default signals .
6,461
public function install ( array $ signals ) { if ( self :: isSupported ( ) ) { $ callback = [ $ this , 'dispatchSignal' ] ; foreach ( $ signals as $ signal ) { \ pcntl_signal ( $ signal , $ callback ) ; } } ; }
Installs selected signal
6,462
public function handle ( $ signal , $ handler , $ namespace = self :: DEFAULT_NAMESPACE ) { if ( empty ( $ this -> handlers [ $ signal ] ) ) { $ this -> handlers [ $ signal ] = [ ] ; } if ( empty ( $ this -> handlers [ $ signal ] [ $ namespace ] ) ) { $ this -> handlers [ $ signal ] [ $ namespace ] = [ ] ; } $ this -> handlers [ $ signal ] [ $ namespace ] [ ] = $ handler ; return $ this ; }
Registers handler for signal in selected namespace .
6,463
public function dispatchSignal ( $ signal ) { if ( isset ( $ this -> handlers [ $ signal ] ) ) { foreach ( $ this -> handlers [ $ signal ] as $ namespaceHandlers ) { foreach ( $ namespaceHandlers as $ handler ) { $ handler ( ) ; } } } return $ this ; }
Dispatch signal on registered handlers .
6,464
public function batchInsert ( \ Phalcon \ Db \ Adapter $ connection , $ tableName , $ fields ) { $ migrationData = $ this -> migrationsDir . '/' . $ this -> version . '/' . $ tableName . '.dat' ; if ( file_exists ( $ migrationData ) ) { $ connection -> begin ( ) ; $ batchHandler = fopen ( $ migrationData , 'r' ) ; while ( ( $ line = fgets ( $ batchHandler ) ) !== false ) { $ connection -> insert ( $ tableName , explode ( '|' , rtrim ( $ line ) ) , $ fields , false ) ; unset ( $ line ) ; } fclose ( $ batchHandler ) ; $ connection -> commit ( ) ; } }
Inserts data from a data migration file in a table
6,465
public function create ( $ videoKey , $ watermarkConfiguration , $ timeout = 90000 ) { $ this -> validateVideoKey ( $ videoKey ) ; $ this -> validateWatermarkConfiguration ( $ watermarkConfiguration ) ; $ this -> validateTimeout ( $ timeout ) ; $ config = is_array ( $ watermarkConfiguration ) ? $ watermarkConfiguration : array ( $ watermarkConfiguration ) ; $ payload = array ( "key" => $ videoKey , "settings" => $ config ) ; return $ this -> createAPI ( $ payload , $ timeout ) ; }
Watermarks a video
6,466
protected function createSheet ( $ name ) { $ name = \ Psc \ PHPExcel \ Helper :: sanitizeSheetTitle ( $ name ) ; $ this -> excel -> addSheet ( new PHPExcel_Worksheet ( $ this -> excel , $ name ) ) ; $ this -> excel -> setActiveSheetIndexByName ( $ name ) ; $ this -> sheet = $ this -> excel -> getActiveSheet ( ) ; $ this -> setRow ( 1 ) ; }
Setzt this - > sheet auf das gerade erstellte Sheet und die Row auf Zeile 1
6,467
public function addTable ( $ tableName , $ csvFile ) { if ( ! is_file ( $ csvFile ) ) { throw new \ InvalidArgumentException ( "Could not find csv file: {$csvFile}" ) ; } if ( ! is_readable ( $ csvFile ) ) { throw new \ InvalidArgumentException ( "Could not read csv file: {$csvFile}" ) ; } $ fh = fopen ( $ csvFile , 'rb' ) ; fseek ( $ fh , 2 ) ; $ tmpFp = fopen ( 'php://temp' , 'w+b' ) ; fwrite ( $ tmpFp , mb_convert_encoding ( stream_get_contents ( $ fh ) , 'UTF-8' , 'UTF-16LE' ) ) ; rewind ( $ tmpFp ) ; $ columns = $ this -> getCsvRow ( $ tmpFp ) ; if ( $ columns === FALSE ) { throw new \ InvalidArgumentException ( "Could not determine the headers from the given file {$csvFile}" ) ; } $ metaData = new \ PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData ( $ tableName , $ columns ) ; $ table = new \ PHPUnit_Extensions_Database_DataSet_DefaultTable ( $ metaData ) ; while ( ( $ row = $ this -> getCsvRow ( $ tmpFp ) ) !== FALSE ) { $ table -> addRow ( array_combine ( $ columns , $ row ) ) ; } $ this -> tables [ $ tableName ] = $ table ; }
Adds a table to the dataset
6,468
public function renderClearing ( ) { if ( empty ( $ this -> items ) ) { return true ; } $ list = array ( ) ; foreach ( $ this -> items as $ item ) { $ list [ ] = $ this -> renderItem ( $ item ) ; } return \ CHtml :: tag ( 'ul' , $ this -> htmlOptions , implode ( "\n" , $ list ) ) ; }
Renders the clearing widget
6,469
public static function isValidMarkup ( $ html , $ message = '' , ConnectorInterface $ connector = null ) { if ( empty ( $ html ) || ! is_string ( $ html ) ) { throw \ PHPUnit_Util_InvalidArgumentHelper :: factory ( 1 , 'string' ) ; } if ( $ connector === null ) { $ connector = new HTML5ValidatorNuConnector ( ) ; } $ connector -> setInput ( $ html ) ; $ response = $ connector -> execute ( 'markup' ) ; $ constraint = new GenericConstraint ( $ connector ) ; self :: assertThat ( $ response , $ constraint , $ message ) ; }
Asserts that the HTML5 string is valid .
6,470
public static function isValidFile ( $ path , $ message = '' , ConnectorInterface $ connector = null ) { if ( ! file_exists ( $ path ) ) { throw new \ PHPUnit_Framework_Exception ( sprintf ( 'File "%s" does not exist.' . "\n" , $ path ) ) ; } $ html = file_get_contents ( $ path ) ; if ( $ html === false ) { throw new \ PHPUnit_Framework_Exception ( sprintf ( 'Cannot read file "%s".' . "\n" , $ path ) ) ; } if ( $ connector === null ) { $ connector = new HTML5ValidatorNuConnector ( ) ; } $ connector -> setInput ( $ html ) ; $ response = $ connector -> execute ( 'file' ) ; $ constraint = new GenericConstraint ( $ connector ) ; self :: assertThat ( $ response , $ constraint , $ message ) ; }
Asserts that the HTML5 file is valid .
6,471
public static function isValidURL ( $ url , $ message = '' , ConnectorInterface $ connector = null ) { if ( empty ( $ url ) || ! is_string ( $ url ) ) { throw \ PHPUnit_Util_InvalidArgumentHelper :: factory ( 1 , 'string' ) ; } if ( filter_var ( $ url , FILTER_VALIDATE_URL ) === false ) { throw new \ PHPUnit_Framework_Exception ( "Url is not valid.\n" ) ; } if ( $ connector === null ) { $ connector = new HTML5ValidatorNuConnector ( ) ; } $ connector -> setInput ( $ url ) ; $ response = $ connector -> execute ( 'url' ) ; $ constraint = new GenericConstraint ( $ connector ) ; self :: assertThat ( $ response , $ constraint , $ message ) ; }
Asserts that the HTML5 url is valid .
6,472
public static function create ( $ modelAlias = null , $ criteria = null ) { if ( $ criteria instanceof RemoteAppQuery ) { return $ criteria ; } $ query = new RemoteAppQuery ( null , null , $ modelAlias ) ; if ( $ criteria instanceof Criteria ) { $ query -> mergeWith ( $ criteria ) ; } return $ query ; }
Returns a new RemoteAppQuery object .
6,473
protected function findPkComplex ( $ key , $ con ) { $ criteria = $ this -> isKeepQuery ( ) ? clone $ this : $ this ; $ stmt = $ criteria -> filterByPrimaryKey ( $ key ) -> doSelect ( $ con ) ; return $ criteria -> getFormatter ( ) -> init ( $ criteria ) -> formatOne ( $ stmt ) ; }
Find object by primary key .
6,474
public function filterByApiUrl ( $ apiUrl = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ apiUrl ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ apiUrl ) ) { $ apiUrl = str_replace ( '*' , '%' , $ apiUrl ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: API_URL , $ apiUrl , $ comparison ) ; }
Filter the query on the api_url column
6,475
public function filterByApiAuthHttpUser ( $ apiAuthHttpUser = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ apiAuthHttpUser ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ apiAuthHttpUser ) ) { $ apiAuthHttpUser = str_replace ( '*' , '%' , $ apiAuthHttpUser ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: API_AUTH_HTTP_USER , $ apiAuthHttpUser , $ comparison ) ; }
Filter the query on the api_auth_http_user column
6,476
public function filterByApiAuthHttpPassword ( $ apiAuthHttpPassword = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ apiAuthHttpPassword ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ apiAuthHttpPassword ) ) { $ apiAuthHttpPassword = str_replace ( '*' , '%' , $ apiAuthHttpPassword ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: API_AUTH_HTTP_PASSWORD , $ apiAuthHttpPassword , $ comparison ) ; }
Filter the query on the api_auth_http_password column
6,477
public function filterByApiAuthType ( $ apiAuthType = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ apiAuthType ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ apiAuthType ) ) { $ apiAuthType = str_replace ( '*' , '%' , $ apiAuthType ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: API_AUTH_TYPE , $ apiAuthType , $ comparison ) ; }
Filter the query on the api_auth_type column
6,478
public function filterByApiAuthUser ( $ apiAuthUser = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ apiAuthUser ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ apiAuthUser ) ) { $ apiAuthUser = str_replace ( '*' , '%' , $ apiAuthUser ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: API_AUTH_USER , $ apiAuthUser , $ comparison ) ; }
Filter the query on the api_auth_user column
6,479
public function filterByApiAuthPassword ( $ apiAuthPassword = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ apiAuthPassword ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ apiAuthPassword ) ) { $ apiAuthPassword = str_replace ( '*' , '%' , $ apiAuthPassword ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: API_AUTH_PASSWORD , $ apiAuthPassword , $ comparison ) ; }
Filter the query on the api_auth_password column
6,480
public function filterByApiAuthToken ( $ apiAuthToken = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ apiAuthToken ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ apiAuthToken ) ) { $ apiAuthToken = str_replace ( '*' , '%' , $ apiAuthToken ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: API_AUTH_TOKEN , $ apiAuthToken , $ comparison ) ; }
Filter the query on the api_auth_token column
6,481
public function filterByApiAuthUrlUserKey ( $ apiAuthUrlUserKey = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ apiAuthUrlUserKey ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ apiAuthUrlUserKey ) ) { $ apiAuthUrlUserKey = str_replace ( '*' , '%' , $ apiAuthUrlUserKey ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: API_AUTH_URL_USER_KEY , $ apiAuthUrlUserKey , $ comparison ) ; }
Filter the query on the api_auth_url_user_key column
6,482
public function filterByApiAuthUrlPwKey ( $ apiAuthUrlPwKey = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ apiAuthUrlPwKey ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ apiAuthUrlPwKey ) ) { $ apiAuthUrlPwKey = str_replace ( '*' , '%' , $ apiAuthUrlPwKey ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: API_AUTH_URL_PW_KEY , $ apiAuthUrlPwKey , $ comparison ) ; }
Filter the query on the api_auth_url_pw_key column
6,483
public function filterByCron ( $ cron = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ cron ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ cron ) ) { $ cron = str_replace ( '*' , '%' , $ cron ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: CRON , $ cron , $ comparison ) ; }
Filter the query on the cron column
6,484
public function filterByCustomerId ( $ customerId = null , $ comparison = null ) { if ( is_array ( $ customerId ) ) { $ useMinMax = false ; if ( isset ( $ customerId [ 'min' ] ) ) { $ this -> addUsingAlias ( RemoteAppPeer :: CUSTOMER_ID , $ customerId [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ customerId [ 'max' ] ) ) { $ this -> addUsingAlias ( RemoteAppPeer :: CUSTOMER_ID , $ customerId [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: CUSTOMER_ID , $ customerId , $ comparison ) ; }
Filter the query on the customer_id column
6,485
public function filterByLastRun ( $ lastRun = null , $ comparison = null ) { if ( is_array ( $ lastRun ) ) { $ useMinMax = false ; if ( isset ( $ lastRun [ 'min' ] ) ) { $ this -> addUsingAlias ( RemoteAppPeer :: LAST_RUN , $ lastRun [ 'min' ] , Criteria :: GREATER_EQUAL ) ; $ useMinMax = true ; } if ( isset ( $ lastRun [ 'max' ] ) ) { $ this -> addUsingAlias ( RemoteAppPeer :: LAST_RUN , $ lastRun [ 'max' ] , Criteria :: LESS_EQUAL ) ; $ useMinMax = true ; } if ( $ useMinMax ) { return $ this ; } if ( null === $ comparison ) { $ comparison = Criteria :: IN ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: LAST_RUN , $ lastRun , $ comparison ) ; }
Filter the query on the last_run column
6,486
public function filterByIncludelog ( $ includelog = null , $ comparison = null ) { if ( is_string ( $ includelog ) ) { $ includelog = in_array ( strtolower ( $ includelog ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( RemoteAppPeer :: INCLUDELOG , $ includelog , $ comparison ) ; }
Filter the query on the includeLog column
6,487
public function filterByPublicKey ( $ publicKey = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ publicKey ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ publicKey ) ) { $ publicKey = str_replace ( '*' , '%' , $ publicKey ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: PUBLIC_KEY , $ publicKey , $ comparison ) ; }
Filter the query on the public_key column
6,488
public function filterByWebsiteHash ( $ websiteHash = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ websiteHash ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ websiteHash ) ) { $ websiteHash = str_replace ( '*' , '%' , $ websiteHash ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: WEBSITE_HASH , $ websiteHash , $ comparison ) ; }
Filter the query on the website_hash column
6,489
public function filterByNotificationRecipient ( $ notificationRecipient = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ notificationRecipient ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ notificationRecipient ) ) { $ notificationRecipient = str_replace ( '*' , '%' , $ notificationRecipient ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: NOTIFICATION_RECIPIENT , $ notificationRecipient , $ comparison ) ; }
Filter the query on the notification_recipient column
6,490
public function filterByNotificationSender ( $ notificationSender = null , $ comparison = null ) { if ( null === $ comparison ) { if ( is_array ( $ notificationSender ) ) { $ comparison = Criteria :: IN ; } elseif ( preg_match ( '/[\%\*]/' , $ notificationSender ) ) { $ notificationSender = str_replace ( '*' , '%' , $ notificationSender ) ; $ comparison = Criteria :: LIKE ; } } return $ this -> addUsingAlias ( RemoteAppPeer :: NOTIFICATION_SENDER , $ notificationSender , $ comparison ) ; }
Filter the query on the notification_sender column
6,491
public function filterByNotificationChange ( $ notificationChange = null , $ comparison = null ) { if ( is_string ( $ notificationChange ) ) { $ notificationChange = in_array ( strtolower ( $ notificationChange ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( RemoteAppPeer :: NOTIFICATION_CHANGE , $ notificationChange , $ comparison ) ; }
Filter the query on the notification_change column
6,492
public function filterByNotificationError ( $ notificationError = null , $ comparison = null ) { if ( is_string ( $ notificationError ) ) { $ notificationError = in_array ( strtolower ( $ notificationError ) , array ( 'false' , 'off' , '-' , 'no' , 'n' , '0' , '' ) ) ? false : true ; } return $ this -> addUsingAlias ( RemoteAppPeer :: NOTIFICATION_ERROR , $ notificationError , $ comparison ) ; }
Filter the query on the notification_error column
6,493
public function filterByApiLog ( $ apiLog , $ comparison = null ) { if ( $ apiLog instanceof ApiLog ) { return $ this -> addUsingAlias ( RemoteAppPeer :: ID , $ apiLog -> getRemoteAppId ( ) , $ comparison ) ; } elseif ( $ apiLog instanceof PropelObjectCollection ) { return $ this -> useApiLogQuery ( ) -> filterByPrimaryKeys ( $ apiLog -> getPrimaryKeys ( ) ) -> endUse ( ) ; } else { throw new PropelException ( 'filterByApiLog() only accepts arguments of type ApiLog or PropelCollection' ) ; } }
Filter the query by a related ApiLog object
6,494
public function useApiLogQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinApiLog ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'ApiLog' , '\Slashworks\AppBundle\Model\ApiLogQuery' ) ; }
Use the ApiLog relation ApiLog object
6,495
public function filterByRemoteHistoryContao ( $ remoteHistoryContao , $ comparison = null ) { if ( $ remoteHistoryContao instanceof RemoteHistoryContao ) { return $ this -> addUsingAlias ( RemoteAppPeer :: ID , $ remoteHistoryContao -> getRemoteAppId ( ) , $ comparison ) ; } elseif ( $ remoteHistoryContao instanceof PropelObjectCollection ) { return $ this -> useRemoteHistoryContaoQuery ( ) -> filterByPrimaryKeys ( $ remoteHistoryContao -> getPrimaryKeys ( ) ) -> endUse ( ) ; } else { throw new PropelException ( 'filterByRemoteHistoryContao() only accepts arguments of type RemoteHistoryContao or PropelCollection' ) ; } }
Filter the query by a related RemoteHistoryContao object
6,496
public function useRemoteHistoryContaoQuery ( $ relationAlias = null , $ joinType = Criteria :: INNER_JOIN ) { return $ this -> joinRemoteHistoryContao ( $ relationAlias , $ joinType ) -> useQuery ( $ relationAlias ? $ relationAlias : 'RemoteHistoryContao' , '\Slashworks\AppBundle\Model\RemoteHistoryContaoQuery' ) ; }
Use the RemoteHistoryContao relation RemoteHistoryContao object
6,497
public function getFormField ( $ name = null , $ title = null , $ value = null ) { return SimpleSpamGuardField :: create ( $ name , $ title , $ value ) -> setTimeLimit ( $ this -> timeLimit ) ; }
Answers the form field used for implementing the spam guard .
6,498
protected function doConvert ( ) { $ expectOperator = true ; while ( false !== ( $ token = $ this -> nextToken ( ) ) ) { $ expectOperator = ! $ expectOperator ; if ( $ token instanceof Expression ) { if ( $ expectOperator ) { $ token -> error ( 'unexpected operand' ) ; } $ this -> operands [ ] = $ token ; continue ; } else { if ( ! $ expectOperator ) { $ token -> error ( 'unexpected operator' ) ; } $ lastOp = end ( $ this -> operators ) ; while ( $ lastOp && self :: $ precedence [ $ token -> name ] <= self :: $ precedence [ $ lastOp -> name ] ) { $ this -> doOperation ( $ lastOp ) ; array_pop ( $ this -> operators ) ; $ lastOp = end ( $ this -> operators ) ; } $ this -> operators [ ] = $ token ; } } while ( $ op = array_pop ( $ this -> operators ) ) { $ this -> doOperation ( $ op ) ; } if ( ! count ( $ this -> operands ) ) { $ this -> error ( 'condition expected' ) ; } elseif ( count ( $ this -> operands ) > 1 ) { $ this -> error ( 'missing operator or too many operands' ) ; } $ value = $ this -> operands [ 0 ] ; if ( $ value -> type !== 'boolean' ) { $ this -> error ( 'the result must have a boolean type' ) ; } return $ this -> operands [ 0 ] -> rpn ; }
Do the operation .
6,499
protected function write ( $ destination , $ content ) { $ directory = dirname ( $ destination ) ; if ( ! $ this -> files -> exists ( $ directory ) ) { $ this -> files -> makeDirectory ( $ directory , 0755 , true ) ; } return ( bool ) $ this -> files -> put ( $ destination , $ content ) ; }
Write file contents creating any necessary subdirectories .