idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
238,500 | public function has ( $ key ) { $ res = $ this -> frontHas ( $ key ) ; if ( $ res ) { return $ res ; } return $ this -> backHas ( $ key ) ; } | Either end has is ok |
238,501 | public function clear ( ) { $ ends = [ $ this -> front , $ this -> back ] ; foreach ( $ ends as $ end ) { if ( ! $ end -> clear ( ) ) { return $ this -> falseAndSetError ( $ end -> getError ( ) , $ end -> getErrorCode ( ) ) ; } } return $ this -> trueAndFlushError ( ) ; } | Need both ends clear ok |
238,502 | public function delete ( $ key ) { $ ends = [ $ this -> front , $ this -> back ] ; foreach ( $ ends as $ end ) { if ( ! $ end -> delete ( $ key ) ) { return $ this -> falseAndSetError ( $ end -> getError ( ) , $ end -> getErrorCode ( ) ) ; } } return $ this -> trueAndFlushError ( ) ; } | Need both ends delete ok |
238,503 | public function commit ( ) { $ ends = [ $ this -> front , $ this -> back ] ; $ res = false ; foreach ( $ ends as $ end ) { if ( ! $ end -> commit ( ) ) { $ this -> setError ( $ end -> getError ( ) , $ end -> getErrorCode ( ) ) ; } else { $ res = true ; } } return $ res ; } | One end commit ok is ok |
238,504 | public function purge ( $ maxlife ) { $ ends = [ $ this -> front , $ this -> back ] ; foreach ( $ ends as $ end ) { if ( ! $ end -> purge ( $ maxlife ) ) { return $ this -> falseAndSetError ( $ end -> getError ( ) , $ end -> getErrorCode ( ) ) ; } } return $ this -> trueAndFlushError ( ) ; } | Need both ends purge ok |
238,505 | protected function protectedSave ( CacheItemInterface $ item , $ function = 'save' ) { $ func = $ this -> tester ; $ both = $ func ( $ item ) ; $ res1 = false ; if ( $ both ) { if ( $ this -> front -> $ function ( $ item ) ) { $ res1 = true ; } else { $ this -> setError ( $ this -> front -> getError ( ) , $ this -> fro... | local save method one end save ok is ok |
238,506 | private function fill ( $ attributes ) { if ( is_string ( $ attributes ) ) { $ attributes = json_decode ( $ attributes , true ) ; } if ( ! is_array ( $ attributes ) ) { throw new \ InvalidArgumentException ( 'Attributes must be of type array or a valid json string' ) ; } foreach ( $ attributes as $ key => $ value ) { $... | Fill the attributes |
238,507 | public function makeCollection ( array $ values , $ class = null ) { $ collection = new Collection ( $ values ) ; if ( ! is_null ( $ class ) && class_exists ( $ class ) ) { $ model = new $ class ( ) ; if ( $ model instanceof Model ) { foreach ( $ collection as $ key => $ item ) { $ collection [ $ key ] = $ model -> new... | Transform an array of values into a collection of models |
238,508 | public function registerService ( ) { $ this -> app -> bind ( 'mrs.attributes.translator' , function ( $ attributeMap = [ ] ) { return new AttributeTranslator ( $ attributeMap ) ; } ) ; $ this -> app -> alias ( 'mrs.attributes.translator' , 'attributes.translator' ) ; $ this -> app -> alias ( 'mrs.attributes.translator... | Register services to the application container . |
238,509 | public function readElement ( ) { $ csv_line_data = $ this -> spl_file_object -> fgetcsv ( ) ; if ( $ csv_line_data ) { $ csv_line_data [ 0 ] = $ this -> convertToUtf8 ( $ csv_line_data ) ; if ( $ this -> isValidLine ( $ csv_line_data ) ) { $ csv_line = array_combine ( $ this -> columns_name , $ csv_line_data ) ; retur... | Reads a single element from the source then return a Object instance |
238,510 | public function readElements ( ) { $ iterator = new ArrayIterator ; do { $ object = $ this -> readElement ( ) ; if ( $ object ) $ iterator -> append ( $ object ) ; } while ( ( boolean ) $ object ) ; $ this -> objects = $ iterator ; return $ this -> objects ; } | Read all the objects from the source |
238,511 | public function addField ( $ fieldName , $ getMethod , $ setMethod , ByConfigBuilder $ include = null , $ formatter = null ) { if ( method_exists ( $ this -> getEntityPrototype ( ) , $ getMethod ) === false ) { throw new Exception \ ConfigFailed ( sprintf ( $ this -> exceptions [ 2 ] , $ getMethod , $ this -> entityCla... | Set a mapping |
238,512 | public function isInclude ( $ fieldName ) { if ( $ this -> hasField ( $ fieldName ) === false ) { return false ; } $ class = __CLASS__ ; return ( $ this -> mapping [ $ fieldName ] [ 'include' ] instanceof $ class ) ; } | Check if the given fieldName is an include |
238,513 | public function getSetter ( $ fieldName ) { if ( $ this -> hasField ( $ fieldName ) === false ) { return false ; } return $ this -> mapping [ $ fieldName ] [ 'setter' ] ; } | Return the setter name |
238,514 | public function getGetter ( $ fieldName ) { if ( $ this -> hasField ( $ fieldName ) === false ) { return false ; } return $ this -> mapping [ $ fieldName ] [ 'getter' ] ; } | Return the getter name |
238,515 | public function getInclude ( $ fieldName ) { if ( $ this -> isInclude ( $ fieldName ) === false ) { return false ; } return $ this -> mapping [ $ fieldName ] [ 'include' ] ; } | Get the include config |
238,516 | public function setCatchAllSetter ( $ setMethod ) { if ( method_exists ( $ this -> getEntityPrototype ( ) , $ setMethod ) === false ) { throw new Exception \ ConfigFailed ( sprintf ( $ this -> exceptions [ 2 ] , $ setMethod , $ this -> entityClassName ) , 2 ) ; } $ this -> catchAllSetter = $ setMethod ; return $ this ;... | Sets an catchall Setter |
238,517 | public static function init ( ) { $ c = new Configuration ( ) ; $ cc = $ c -> from ( 'app' ) -> get ( 'session' ) ; if ( strtolower ( $ cc ) == 'session' ) { return new Session ( ) ; } elseif ( strtolower ( $ cc ) == 'file' ) { return new File ( ) ; } elseif ( strtolower ( $ cc ) == 'cookie' ) { return new Cookie ( ) ;... | Initializes session handler . |
238,518 | public function getByName ( $ name ) { $ response = $ this -> getPuppetDbClient ( ) -> send ( new KmbPuppetDb \ Request ( '/nodes/' . $ name ) ) ; return $ this -> createNodeFromData ( $ response -> getData ( ) ) ; } | Retrieves a node by its name . |
238,519 | public function registerInternalCache ( ) { $ cacheManager = $ this -> getCacheManager ( ) ; if ( false === $ cacheManager -> hasCache ( self :: CACHE_IDENTIFIER ) ) { $ cacheManager -> setCacheConfigurations ( [ self :: CACHE_IDENTIFIER => $ this -> cacheOptions ] ) ; } } | Function called from ext_localconf file which will register the internal cache earlier . |
238,520 | public function registerDynamicCaches ( ) { $ dynamicCaches = $ this -> getCache ( ) -> getByTag ( self :: CACHE_TAG_DYNAMIC_CACHE ) ; foreach ( $ dynamicCaches as $ cacheData ) { $ identifier = $ cacheData [ 'identifier' ] ; $ options = $ cacheData [ 'options' ] ; $ this -> registerCacheInternal ( $ identifier , $ opt... | This function will take care of initializing all caches that were defined previously by the CacheService which allows dynamic caches to be used for every configuration object type . |
238,521 | public static function injectInstance ( Resolver $ resolver ) { $ sub = $ resolver -> getResolver ( 'assets' ) ; return $ sub !== null ? new static ( $ sub ) : null ; } | Generate an instance for the injector |
238,522 | public function addScript ( string $ script , $ depends = null ) { $ script = $ this -> stripSuffix ( $ script , ".min" , ".js" ) ; $ this -> scripts [ $ script ] = array ( "path" => $ script , "depends" => $ depends ) ; return $ this ; } | Add a javascript file to be loaded . This will strip the . min and . js suffixes and add them to the stack of included scripts . |
238,523 | public function addCSS ( string $ stylesheet , $ media = "screen" ) { $ stylesheet = $ this -> stripSuffix ( $ stylesheet , ".min" , ".css" ) ; $ this -> CSS [ $ stylesheet ] = array ( "path" => $ stylesheet , "media" => $ media ) ; return $ this ; } | Add a CSS stylesheet to be loaded . This will strip the . min and . css suffixes and add them to the stack of included stylesheets . |
238,524 | public function addVariable ( string $ name , $ value ) { if ( WF :: is_array_like ( $ value ) ) { $ value = WF :: to_array ( $ value ) ; } elseif ( is_subclass_of ( $ value , JSONSerializable :: class ) ) { $ value = $ value -> jsonSerialize ( ) ; } elseif ( ! is_scalar ( $ value ) ) { throw new InvalidArgumentExcepti... | Add a javascript variable to be added to the output document . A script will be generated to definie these variables on page load . |
238,525 | protected function stripSuffix ( string $ path , string $ suffix1 , string $ suffix2 ) { if ( substr ( $ path , - strlen ( $ suffix2 ) ) === $ suffix2 ) $ path = substr ( $ path , 0 , - strlen ( $ suffix2 ) ) ; if ( substr ( $ path , - strlen ( $ suffix1 ) ) === $ suffix1 ) $ path = substr ( $ path , 0 , - strlen ( $ s... | Remove the suffix from a file name such as . min . css or . min . js |
238,526 | public function executeHook ( Dictionary $ params ) { $ responder = $ params [ 'responder' ] ?? null ; $ mime = $ params [ 'mime' ] ?? null ; $ result = empty ( $ responder ) ? null : $ responder -> getResult ( ) ; $ response = empty ( $ result ) ? null : $ result -> getResponse ( ) ; if ( $ response instanceof HTTPErr... | Execute the hook to replace the Javascript and CSS tokens in the HTTP Responder . This will be called by Wedeto \ Util \ Hook through Wedeto \ HTTP . It can be called directly when you want to replace the content at a different time . |
238,527 | public function getRoomsListAction ( ParamFetcher $ paramFetcher ) { $ page = $ paramFetcher -> get ( 'page' ) ; $ count = $ paramFetcher -> get ( 'count' ) ; $ pager = $ this -> getRoomManager ( ) -> getPager ( $ this -> filterCriteria ( $ paramFetcher ) , $ page , $ count ) ; return $ pager ; } | Retrieve the list of available rooms |
238,528 | public function query ( $ statement , $ params = array ( ) ) { if ( ! is_array ( $ params ) ) { $ params = array ( $ params ) ; } return $ this -> _link -> query ( $ statement , $ params ) ; } | Run database query and return complete result set |
238,529 | public function exec ( $ statement , $ params = array ( ) ) { if ( ! is_array ( $ params ) ) { $ params = array ( $ params ) ; } return $ this -> _link -> exec ( $ statement , $ params ) ; } | Execute a database statement that does not return a result set |
238,530 | public function prepareValue ( $ value , $ datatype ) { if ( $ value === null ) { return 'NULL' ; } switch ( $ datatype ) { case Column :: TYPE_INTEGER : $ filtered = filter_var ( $ value , FILTER_VALIDATE_INT ) ; if ( $ filtered === false ) { throw new \ InvalidArgumentException ( 'Not an integer: ' . $ value ) ; } re... | Prepare a literal value for insertion into an SQL statement |
238,531 | public function getName ( ) { if ( ! $ this -> _name ) { $ result = $ this -> query ( 'select catalog_name from information_schema.information_schema_catalog_name' ) ; $ this -> _name = $ result [ 0 ] [ 'catalog_name' ] ; } return $ this -> _name ; } | Return name of the database that the current connection points to |
238,532 | public function getTable ( $ name ) { if ( $ name != strtolower ( $ name ) ) { throw new \ DomainException ( 'Table name must be lowercase: ' . $ name ) ; } if ( ! isset ( $ this -> _tables [ $ name ] ) ) { $ class = 'Nada\Table\\' . $ this -> getDbmsSuffix ( ) ; $ this -> _tables [ $ name ] = new $ class ( $ this , $ ... | Get access to a specific table |
238,533 | public function getTables ( ) { if ( ! $ this -> _allTablesFetched ) { $ tables = $ this -> getTableNames ( ) ; foreach ( $ tables as $ table ) { $ this -> getTable ( $ table ) ; } ksort ( $ this -> _tables ) ; $ this -> _allTablesFetched = true ; } return $ this -> _tables ; } | Return all tables |
238,534 | public function getViewNames ( ) { $ names = $ this -> query ( 'SELECT table_name FROM information_schema.tables WHERE table_schema=? AND table_type=?' , array ( $ this -> getTableSchema ( ) , 'VIEW' ) ) ; foreach ( $ names as & $ name ) { $ name = $ name [ 'table_name' ] ; } return $ names ; } | Return list of all view names |
238,535 | public function getNativeDatatype ( $ type , $ length = null , $ cast = false ) { switch ( $ type ) { case Column :: TYPE_INTEGER : if ( $ length === null ) { $ length = Column :: DEFAULT_LENGTH_INTEGER ; } switch ( $ length ) { case 16 : return 'SMALLINT' ; case 32 : return 'INTEGER' ; case 64 : return 'BIGINT' ; defa... | Get DBMS - specific datatype for abstract NADA datatype |
238,536 | public function createColumn ( $ name , $ type , $ length = null , $ notnull = false , $ default = null , $ autoIncrement = false , $ comment = null ) { $ column = $ this -> createColumnObject ( ) ; $ column -> constructNew ( $ this , $ name , $ type , $ length , $ notnull , $ default , $ autoIncrement , $ comment ) ; ... | Construct a new column |
238,537 | public function createColumnFromArray ( array $ data ) { return $ this -> createColumn ( $ data [ 'name' ] , $ data [ 'type' ] , $ data [ 'length' ] , ! empty ( $ data [ 'notnull' ] ) , @ $ data [ 'default' ] , ! empty ( $ data [ 'autoincrement' ] ) , @ $ data [ 'comment' ] ) ; } | Construct a new column with data from an array |
238,538 | public function createTable ( $ name , array $ columns , $ primaryKey = null ) { $ name = strtolower ( $ name ) ; if ( strpos ( $ name , 'sqlite_' ) === 0 ) { throw new \ InvalidArgumentException ( 'Created table name must not begin with sqlite_' ) ; } if ( empty ( $ columns ) ) { throw new \ InvalidArgumentException (... | Create a table |
238,539 | protected function _getTablePkDeclaration ( array $ primaryKey , $ autoIncrement ) { foreach ( $ primaryKey as & $ column ) { $ column = $ this -> prepareIdentifier ( $ column ) ; } return ",\nPRIMARY KEY (" . implode ( ', ' , $ primaryKey ) . ')' ; } | Get the declaration for a table s primary key |
238,540 | protected function indexAnnotationsByType ( array $ annotations ) { $ indexed = array ( ) ; if ( $ annotations && is_numeric ( key ( $ annotations ) ) ) { foreach ( $ annotations as $ annotation ) { $ annotationType = get_class ( $ annotation ) ; if ( isset ( $ indexed [ $ annotationType ] ) && ! is_array ( $ indexed [... | Indexes a numerically - indexed array of annotation instances by their class names . |
238,541 | public function build ( array $ filterConfigurations ) { $ resolver = new OptionsResolver ( ) ; $ filters = [ ] ; foreach ( $ filterConfigurations as $ filterName => $ filterConfiguration ) { $ resolver -> clear ( ) ; if ( $ filterConfiguration === null ) { $ filterConfiguration = [ ] ; } $ configuration = $ this -> ge... | Build the filter with the given configuration . |
238,542 | protected function getFilterConfiguration ( $ filter ) { if ( ! array_key_exists ( $ filter , $ this -> mapping ) ) { throw new Exception ( $ filter . ' filter not found in assets mapping. Check your configuration' ) ; } $ class = $ this -> mapping [ $ filter ] . 'Configuration' ; if ( ! class_exists ( $ class ) ) { th... | Return filter configuration instance using the configured mapping . |
238,543 | public function getDecodedJson ( ) : array { if ( ! ( $ array = json_decode ( $ this -> json , true ) ) ) { throw new \ RuntimeException ( "Unable to decode the response's JSON" ) ; } return json_decode ( $ this -> json , true ) ; } | Returns the decoded JSON string . |
238,544 | public static function fromString ( $ string ) { if ( is_null ( $ string ) || empty ( $ string ) || ! is_string ( $ string ) ) { throw new \ InvalidArgumentException ( 'The given ReCaptcha response data is invalid.' , 1452283305 ) ; } $ value = ( string ) $ string ; $ value = filter_var ( $ value , FILTER_SANITIZE_STRI... | Creates the ReCaptchaResponse data object |
238,545 | public function toArray ( ) { $ aReturn = array ( ) ; foreach ( get_object_vars ( $ this ) as $ sKey => $ mValue ) { if ( is_object ( $ mValue ) and true === method_exists ( $ mValue , 'toArray' ) ) { $ aReturn [ $ sKey ] = $ mValue -> toArray ( ) ; } else { $ aReturn [ $ sKey ] = $ mValue ; } } return $ aReturn ; } | return this entity as array |
238,546 | public static function create ( $ type , $ name , $ value = null , array $ attributes = [ ] , array $ options = [ ] , $ required = false , array $ modifiers = [ ] , array $ validators = [ ] , $ validationErrorMessage = null ) { $ type = strtolower ( $ type ) ; if ( is_array ( $ value ) && $ type !== 'multipleselect' ) ... | create either single FormElement or array of FormElements |
238,547 | private static function createSingleElement ( $ type , $ name , $ value , $ attributes , $ options , $ required , $ modifiers , $ validators , $ validationErrorMessage ) { switch ( $ type ) { case 'input' : $ elem = new InputElement ( $ name ) ; break ; case 'file' : $ elem = new FileInputElement ( $ name ) ; break ; c... | generate a single form element |
238,548 | protected function filter ( array $ list ) { $ tmp = [ ] ; foreach ( $ list as $ item ) { if ( $ item [ 'anime' ] ) { $ tmp [ ] = $ item ; } } return $ tmp ; } | Filter a list items |
238,549 | public function deleteAction ( $ entity , $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ entity = $ em -> getRepository ( $ entity ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( "Unable to find $entity entity." ) ; } $ em -> remove ( $ entity ) ; $ em -> flush ( ) ; ... | Delete any entity . |
238,550 | public static function FromFloat ( $ value , $ detail = true ) { if ( $ value instanceof XPath2Item ) { $ value = $ value -> getTypedValue ( ) ; } if ( $ value instanceof DecimalValue ) return $ value ; if ( ( ! is_numeric ( $ value ) ) || is_infinite ( $ value ) || is_nan ( $ value ) ) { throw XPath2Exception :: withE... | Creates an instance from a Float value |
238,551 | public function Compare ( $ number , $ scale = false ) { if ( ! is_numeric ( $ number ) ) { if ( ! $ number instanceof DecimalValue && ! $ number instanceof Integer ) { return false ; } $ number = $ number -> getValue ( ) ; } if ( $ scale === false ) { $ scale = max ( $ this -> getScale ( ) , $ this -> scale ( $ number... | Compares this number with another number |
238,552 | private function normalize ( $ number = null ) { if ( is_null ( $ number ) ) $ number = & $ this -> _value ; if ( $ this -> _value == "-0" ) $ this -> _value = "0" ; if ( strpos ( $ this -> _value , '.' ) === false ) return ; $ number = trim ( $ number ) ; $ number = rtrim ( $ number , '0' ) ; $ number = rtrim ( $ numb... | Remove spaces and any trailing zeros |
238,553 | public function getIsDecimal ( $ number = false ) { return strpos ( $ number === false ? $ this -> _value : $ number , "." ) !== false && trim ( substr ( $ number === false ? $ this -> _value : $ number , strpos ( $ number === false ? $ this -> _value : $ number , "." ) + 1 ) , "0" ) ; } | True if the number has a fractional part and it is not zero |
238,554 | public function getCeil ( ) { if ( $ this -> getIsDecimal ( ) === false ) { return $ this ; } if ( $ this -> getIsNegative ( ) === true ) { return new DecimalValue ( bcadd ( $ this -> _value , '0' , 0 ) ) ; } return new DecimalValue ( bcadd ( $ this -> _value , '1' , 0 ) ) ; } | Get the ceiling value of the decimal number |
238,555 | public function getFloor ( $ scale = false ) { if ( $ this -> getIsDecimal ( ) === false ) { return $ this ; } if ( $ this -> getIsNegative ( ) === true ) { return new DecimalValue ( bcadd ( $ this -> _value , '-1' , 0 ) ) ; } return new DecimalValue ( bcadd ( $ this -> _value , '0' , 0 ) ) ; } | Get the number that is one |
238,556 | private function roundDigit ( $ scale , $ mode = PHP_ROUND_HALF_UP ) { if ( $ this -> getIsCloserToNext ( $ scale , $ mode ) ) { return bcadd ( $ this -> _value , $ this -> getIsNegative ( ) ? - 1 : 1 , 0 ) ; } return bcadd ( $ this -> _value , '0' , 0 ) ; } | Round the value to the required precision and using the required mode |
238,557 | public function getIntegerPart ( ) { if ( ! $ this -> getIsDecimal ( ) ) return $ this -> _value ; return substr ( $ this -> _value , 0 , strpos ( $ this -> _value , "." ) ) ; } | Return the part of the number before the decimal point Does not taken into account the size of any fraction . |
238,558 | public function getDecimalIsHalf ( $ scale = false ) { if ( ! $ this -> getIsDecimal ( ) ) { return false ; } if ( $ scale === false ) $ scale = $ this -> scale ( $ this -> _value ) ; if ( $ scale < 0 ) $ scale = $ scale = 0 ; $ decimalPart = $ this -> getDecimalPart ( ) ; if ( $ scale >= strlen ( $ decimalPart ) ) ret... | Test to see if the digit at scale + 1 is a 5 |
238,559 | public function getIsDecimalEven ( $ precision = false ) { if ( ! $ this -> getIsDecimal ( ) ) { return false ; } if ( $ precision === false ) $ precision = $ this -> scale ( $ this -> _value ) ; if ( $ precision < 0 ) $ precision = $ precision = 0 ; $ decimalPart = $ this -> getDecimalPart ( ) ; if ( $ precision >= st... | Returns true if the digit at the required level of precision is even |
238,560 | public function getIsCloserToNext ( $ precision = false , $ mode = PHP_ROUND_HALF_UP ) { if ( ! $ this -> getIsDecimal ( ) ) { return false ; } if ( $ precision === false ) $ precision = $ this -> scale ( $ this -> _value ) ; if ( $ precision < 0 ) $ precision = $ precision = 0 ; $ decimalPart = $ this -> getDecimalPar... | Returns true if the number at the scale position in the decimal part of the number is closer to the next power . |
238,561 | private function dec2bin ( $ decimal ) { bcscale ( 0 ) ; $ binary = '' ; do { $ binary = bcmod ( $ decimal , '2' ) . $ binary ; $ decimal = bcdiv ( $ decimal , '2' ) ; } while ( bccomp ( $ decimal , '0' ) ) ; return ( $ binary ) ; } | Create a binary representation of the current value |
238,562 | public function getIterator ( ) { if ( is_null ( $ this -> _iterator ) ) { $ this -> _iterator = new Iterator ( $ this -> _items ) ; } return $ this -> _iterator ; } | return a iterator |
238,563 | public function remove ( $ element ) { $ index = $ this -> indexOf ( $ element ) ; if ( $ index !== false ) { unset ( $ this -> _items [ $ index ] ) ; $ this -> _items = array_values ( $ this -> _items ) ; $ this -> _iterator = null ; return true ; } return false ; } | remove a specified element from the collection |
238,564 | public function clean ( $ input ) { if ( is_bool ( $ input ) or is_int ( $ input ) or is_float ( $ input ) or $ this -> parent -> isCleaned ( $ input ) ) { return $ input ; } if ( is_string ( $ input ) ) { $ input = $ this -> cleanString ( $ input ) ; } elseif ( is_array ( $ input ) or ( $ input instanceof \ Iterator a... | Cleans string object or array |
238,565 | protected function cleanArray ( $ input ) { if ( is_object ( $ input ) ) { $ this -> parent -> isClean ( $ input ) ; } foreach ( $ input as $ k => $ v ) { $ input [ $ k ] = $ this -> clean ( $ v ) ; } return $ input ; } | cleanArray base method |
238,566 | protected function cleanObject ( $ input ) { $ this -> parent -> isClean ( $ input ) ; foreach ( $ value as $ k => $ v ) { $ value -> { $ k } = $ this -> clean ( $ v ) ; } return $ input ; } | cleanObject base method . Not defined as abstract become some filters might not implement cleaning objects |
238,567 | public function complete ( ) { $ chain = $ this -> chain ; $ this -> chaining = false ; $ this -> chain = null ; return $ chain ; } | Complete a chain and return it s result . |
238,568 | public function update ( $ value ) { $ this -> validate ( $ value ) ; if ( $ this -> chaining ) { $ this -> chain = $ value ; } else { $ this -> current = $ value ; } return $ this ; } | Update a value . |
238,569 | public function reset ( ) { $ this -> current = $ this -> original ; $ this -> chaining = false ; $ this -> chain = null ; return $ this ; } | Reset the variable back to it s original value . |
238,570 | public function validate ( $ value ) { if ( ! in_array ( gettype ( $ value ) , $ this -> types ) ) { throw new Exception ( 'Type of value "' . gettype ( $ value ) . "' is not compatible with " . get_class ( $ this ) ) ; } } | Validate a variables type to make sure our class can use it . |
238,571 | public function getLoaMap ( ) { $ loaMap = [ ] ; foreach ( $ this -> config as $ key => $ config ) { if ( array_key_exists ( 'loa' , $ config ) ) { $ loaMap [ $ key ] = $ config [ 'loa' ] ; } } return $ loaMap ; } | Flattens the config and returns key value pairs where the key is the SF type and the value is the LOA level |
238,572 | public function create ( $ name , $ path ) { $ path = $ this -> getPath ( $ name , $ path ) ; $ stub = $ this -> getStub ( 'model' ) ; $ this -> files -> put ( $ path , $ this -> parseStub ( $ stub , [ 'table' => $ this -> tableize ( $ name ) , 'class' => $ this -> classify ( $ name ) ] ) ) ; return $ path ; } | Create a new model at the given path . |
238,573 | public function get ( $ key ) { $ res = $ this -> _errors [ $ key ] ; if ( ! is_array ( $ res ) ) { return [ $ res ] ; } return $ res ; } | Gets a specific error . |
238,574 | public function first ( $ key ) { if ( $ this -> has ( $ key ) ) { $ err = $ this -> _errors [ $ key ] ; if ( is_array ( $ err ) ) { for ( $ i = 0 ; $ i < count ( $ err ) ; $ i ++ ) { if ( ! empty ( $ err [ $ i ] ) ) { return $ err [ $ i ] ; } } } else { return $ err ; } } return '' ; } | Gets the first message for a specific error . |
238,575 | public function add ( $ data ) { $ ea = ( array ) $ data ; foreach ( $ ea as $ key => $ value ) { if ( is_array ( $ value ) ) { foreach ( $ value as $ k => $ v ) { if ( is_null ( $ v ) ) { unset ( $ value [ $ k ] ) ; } } $ value = array_values ( $ value ) ; $ ea [ $ key ] = $ value ; } } $ this -> _errors = $ ea ; } | Adds all error data . Also clears out any null values . |
238,576 | private function resolveControllerAction ( BoxControllerInterface $ controller ) { $ currentAction = $ this -> routerHelper -> getCurrentAction ( ) ; if ( $ this -> routerHelper -> hasControllerAction ( $ controller , $ currentAction ) ) { return $ currentAction ; } return 'indexAction' ; } | Resolves action which can be used in controller method call |
238,577 | public function findPublishedItems ( array $ where , $ orderBy = null , $ limit = null ) { return $ this -> repository -> findBy ( array_merge ( $ where , [ 'published' => true ] ) , $ orderBy , $ limit ) ; } | Method which finds published items in the repository according to the where clause |
238,578 | public function TemplateFile ( ) { if ( ! $ this -> AllowCustomTemplates ( ) || ! $ this -> content || ! $ this -> content -> GetTemplate ( ) ) { return $ this -> BuiltInTemplateFile ( ) ; } $ file = Path :: Combine ( PathUtil :: ModuleCustomTemplatesFolder ( $ this ) , $ this -> content -> GetTemplate ( ) ) ; return P... | The template file |
238,579 | public function SetTreeItem ( IContentTreeProvider $ tree , $ item ) { $ this -> tree = $ tree ; $ this -> item = $ item ; $ this -> content = $ this -> tree -> ContentByItem ( $ item ) ; } | Sets tree and tree item |
238,580 | public function BackendName ( ) { if ( $ this -> ContentForm ( ) ) { $ this -> ContentForm ( ) -> ReadTranslations ( ) ; } return Trans ( $ this -> MyBundle ( ) . '.' . $ this -> MyName ( ) . '.BackendName' ) ; } | Gets a display name for backend issues can be overridden |
238,581 | protected function BeforeInit ( ) { $ cacheFile = PathUtil :: ContentCacheFile ( $ this ) ; $ this -> fileCacher = new FileCacher ( $ cacheFile , $ this -> content -> GetCacheLifetime ( ) ) ; if ( $ this -> fileCacher -> MustUseCache ( ) ) { $ this -> output = $ this -> fileCacher -> GetFromCache ( ) ; return true ; } ... | Gets cache content if necessary |
238,582 | protected function AfterGather ( ) { if ( $ this -> fileCacher -> MustStoreToCache ( ) ) { $ this -> fileCacher -> StoreToCache ( $ this -> output ) ; } parent :: AfterGather ( ) ; } | Stores to cache if necessary |
238,583 | public function addAttribute ( Attribute $ attribute ) : Attributes { $ this -> getItems ( ) ; $ this -> attributes [ $ attribute -> getName ( ) ] = $ attribute ; return $ this ; } | Add attribute to collection |
238,584 | public static function log ( $ level , $ message , array $ context = [ ] ) { return static :: __do ( __FUNCTION__ , args_with_keys ( func_get_args ( ) , __CLASS__ , __FUNCTION__ ) ) ; } | Logging a message to the logs . |
238,585 | protected function createAlexaRequest ( $ request ) { $ this -> voiceInterface = 'Alexa' ; $ this -> alexaRequest = new AlexaRequest ( $ request -> getBody ( ) -> getContents ( ) , $ this -> askApplicationIds , $ request -> getHeaderLine ( 'Signaturecertchainurl' ) , $ request -> getHeaderLine ( 'Signature' ) , $ this ... | Create Alexa Request from Slim Request |
238,586 | public function dump ( array $ options = array ( ) ) { foreach ( array ( 'graph' , 'node' , 'edge' , 'node.instance' , 'node.definition' , 'node.missing' ) as $ key ) { if ( isset ( $ options [ $ key ] ) ) { $ this -> options [ $ key ] = array_merge ( $ this -> options [ $ key ] , $ options [ $ key ] ) ; } } $ this -> ... | Dumps the service container as a graphviz graph . |
238,587 | private function startDot ( ) { return sprintf ( "digraph sc {\n %s\n node [%s];\n edge [%s];\n\n" , $ this -> addOptions ( $ this -> options [ 'graph' ] ) , $ this -> addOptions ( $ this -> options [ 'node' ] ) , $ this -> addOptions ( $ this -> options [ 'edge' ] ) ) ; } | Returns the start dot . |
238,588 | public function cmdStatusStatus ( ) { $ result = $ this -> report -> getStatus ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableStatus ( $ result ) ; $ this -> output ( ) ; } | Callback for status command |
238,589 | public function find ( $ id ) { return $ this -> getQueryBuilder ( ) -> andWhere ( $ this -> getAlias ( ) . '.id = ' . intval ( $ id ) ) -> getQuery ( ) -> getOneOrNullResult ( ) ; } | Finds the resource by his ID . |
238,590 | public function findBy ( array $ criteria , array $ sorting = null , $ limit = null , $ offset = null ) { $ queryBuilder = $ this -> getCollectionQueryBuilder ( ) ; $ this -> applyCriteria ( $ queryBuilder , $ criteria ) ; $ this -> applySorting ( $ queryBuilder , ( array ) $ sorting ) ; if ( null !== $ limit ) { $ que... | Finds resources by criteria sorting limit and offset . |
238,591 | public function findRandomOneBy ( array $ criteria ) { $ queryBuilder = $ this -> getQueryBuilder ( ) ; $ this -> applyCriteria ( $ queryBuilder , $ criteria ) ; return $ queryBuilder -> addSelect ( 'RAND() as HIDDEN rand' ) -> orderBy ( 'rand' ) -> setMaxResults ( 1 ) -> getQuery ( ) -> getOneOrNullResult ( ) ; } | Finds a random resource by criteria . |
238,592 | public function findRandomBy ( array $ criteria , $ limit ) { $ limit = intval ( $ limit ) ; if ( $ limit <= 1 ) { throw new \ InvalidArgumentException ( 'Please use `findRandomOneBy()` for single result.' ) ; } $ queryBuilder = $ this -> getCollectionQueryBuilder ( ) ; $ this -> applyCriteria ( $ queryBuilder , $ crit... | Finds random resource by criteria and limit . |
238,593 | public function createPager ( array $ criteria = [ ] , array $ sorting = [ ] ) { $ queryBuilder = $ this -> getCollectionQueryBuilder ( ) ; $ this -> applyCriteria ( $ queryBuilder , $ criteria ) ; $ this -> applySorting ( $ queryBuilder , $ sorting ) ; return $ this -> getPager ( $ queryBuilder ) ; } | Creates a pager . |
238,594 | protected function applyCriteria ( QueryBuilder $ queryBuilder , array $ criteria = [ ] ) { foreach ( $ criteria as $ property => $ value ) { $ name = $ this -> getPropertyName ( $ property ) ; if ( null === $ value ) { $ queryBuilder -> andWhere ( $ queryBuilder -> expr ( ) -> isNull ( $ name ) ) ; } elseif ( is_array... | Applies the criteria to the query builder . |
238,595 | public function getCachePrefix ( ) { if ( $ this -> cachePrefix ) { return $ this -> cachePrefix ; } $ class = $ this -> getClassName ( ) ; if ( ! in_array ( TaggedEntityInterface :: class , class_implements ( $ class ) ) ) { throw new \ RuntimeException ( sprintf ( 'The entity %s does not implements %s, query should n... | Returns the cache prefix . |
238,596 | public function create ( $ adapterType , array $ config ) { if ( ! array_key_exists ( $ adapterType , $ this -> adapters ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Cache Adapter\'s key %s does not exist' , $ adapterType ) ) ; } if ( ! isset ( $ config [ $ adapterType ] ) ) { throw new InvalidConfigurationE... | Create an adapter |
238,597 | protected function _quoteRegex ( $ string , $ delimiter = null ) { $ string = $ this -> _normalizeString ( $ string ) ; $ delimiter = is_null ( $ delimiter ) ? null : $ this -> _normalizeString ( $ delimiter ) ; return preg_quote ( $ string , $ delimiter ) ; } | Escapes special characters in a string such that it is interpreted literally by a PCRE parser . |
238,598 | protected function getValueFromDefinition ( $ key ) { return ( isset ( $ this -> definition ) && ! empty ( $ this -> definition [ $ key ] ) ) ? $ this -> definition [ $ key ] : false ; } | This function returns the value of the key from the column definitions . |
238,599 | public function serialize ( ) { return serialize ( [ 'key' => $ this -> key , 'value' => $ this -> value , 'expires' => $ this -> expires , 'hit' => $ this -> hit ] ) ; } | Serialize the item . Required for storing in the containing cache |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.