idx
int64
0
60.3k
question
stringlengths
64
4.24k
target
stringlengths
5
618
3,500
public function validateRedirectHeader ( string $ headerName ) : ValueValidator { if ( $ this -> headers -> contain ( 'REDIRECT_' . $ headerName ) ) { return $ this -> validateHeader ( 'REDIRECT_' . $ headerName ) ; } return $ this -> validateHeader ( $ headerName ) ; }
checks whether a request value from redirect headers is valid or not
3,501
public function readCookie ( string $ cookieName ) : ValueReader { return new ValueReader ( $ this -> cookies -> errors ( ) , $ cookieName , $ this -> cookies -> value ( $ cookieName ) ) ; }
returns request value from cookies for filtering or validation
3,502
public function calculateItemTotalNetPrice ( $ item , $ currency = null , $ useProductsPrice = true , $ isGrossPrice = false ) { $ priceValue = $ this -> calculateItemNetPrice ( $ item , $ currency , $ useProductsPrice , $ isGrossPrice ) ; if ( $ priceValue === null ) { $ priceValue = 0 ; } if ( $ item -> getPrice ( ) ...
Calculates the overall total price of an item .
3,503
public function calculateItemNetPrice ( $ item , $ currency = null , $ useProductsPrice = null , $ isGrossPrice = false ) { $ currency = $ this -> getCurrency ( $ currency ) ; if ( $ useProductsPrice === null ) { $ useProductsPrice = $ item -> getUseProductsPrice ( ) ; } $ this -> validateItem ( $ item ) ; $ priceValue...
Returns price of a single item based on it s quantity .
3,504
public function formatPrice ( $ price , $ currency , $ locale = null ) { return $ this -> priceManager -> getFormattedPrice ( $ price , $ currency , $ locale ) ; }
Format price .
3,505
private function getValidProductNetPriceForItem ( CalculableBulkPriceItemInterface $ item , $ currency ) { $ product = $ item -> getCalcProduct ( ) ; $ areGrossPrices = false ; $ addon = $ item -> getAddon ( ) ; if ( $ addon ) { $ addonPrice = $ this -> priceManager -> getAddonPriceForCurrency ( $ item -> getAddon ( ) ...
Returns the valid product net price for item .
3,506
private function retrieveProductTypeIdByKey ( $ key ) { if ( ! isset ( $ this -> productTypesMap [ $ key ] ) ) { return null ; } return intval ( $ this -> productTypesMap [ $ key ] ) ; }
Returns product type id by key .
3,507
public function getAll ( $ identity , $ page = 1 , $ perPage = 25 ) { $ params = array ( 'page' => $ page , 'per_page' => $ perPage ) ; return $ this -> _user -> get ( 'account/identity/' . $ identity . '/token' , $ params ) ; }
Get all the tokens for an identity
3,508
public function create ( $ identity , $ service , $ token ) { $ params = array ( 'service' => $ service , 'token' => $ token , ) ; return $ this -> _user -> post ( 'account/identity/' . $ identity . '/token' , $ params ) ; }
Creates a token for a service
3,509
public function update ( $ identity , $ service , $ token ) { $ params = array ( 'token' => $ token , ) ; return $ this -> _user -> put ( 'account/identity/' . $ identity . '/token/' . $ service , $ params ) ; }
Updates the token for a service
3,510
public function delete ( $ identity , $ service ) { $ successCode = array ( DataSift_ApiClient :: HTTP_NO_CONTENT ) ; return $ this -> _user -> delete ( 'account/identity/' . $ identity . '/token/' . $ service ) ; }
Deletes a token for a service
3,511
public function & possibilities ( ... $ possibilities ) { if ( $ this -> getDefaultValue ( ) !== null && ! in_array ( $ this -> getDefaultValue ( ) , $ possibilities ) ) { throw new InvalidArgumentException ( 'Default value ' . var_export ( $ this -> getDefaultValue ( ) , true ) . ' needs to be in the list of possibili...
Set a list of possible values .
3,512
public static function getDateTime ( ) { $ dt = \ DateTime :: createFromFormat ( 'U.u' , microtime ( true ) ) ; $ dt -> setTimezone ( new \ DateTimeZone ( date ( 'e' ) ) ) ; return $ dt ; }
Returns DateTime object .
3,513
public function getConnectionTableName ( ) { $ type_names = [ $ this -> getSourceTypeName ( ) , $ this -> getTargetTypeName ( ) ] ; sort ( $ type_names ) ; return implode ( '_' , $ type_names ) ; }
Return connection table name .
3,514
public static function extractUrl ( $ url ) { if ( is_string ( $ url ) ) { $ url = Placeholder :: replaceStringPlaceholders ( $ url ) ; $ url = preg_replace ( '/^url\(|\)$/' , '' , $ url ) ; $ url = str_replace ( [ "\\(" , "\\)" , "\\ " , "\\'" , "\\\"" ] , [ "(" , ")" , " " , "'" , "\"" ] , $ url ) ; $ url = preg_repl...
Extracts the URL from a CSS URL value .
3,515
function range ( $ min = null , $ max = null ) { $ this -> min ( $ min ) ; $ this -> max ( $ max ) ; return $ this ; }
Set the minimum and maximum
3,516
function exclusiveRange ( $ min = null , $ max = null ) { $ this -> exclusiveMin ( $ min ) ; $ this -> exclusiveMax ( $ max ) ; return $ this ; }
Set the exclusive minimum and maximum
3,517
public function add ( $ tag ) { if ( ! $ tag instanceof TagInterface ) { throw new \ InvalidArgumentException ( 'This tag is not allowed' ) ; } if ( $ this -> isUniqueTag ( $ tag -> getName ( ) ) ) { $ this -> removeByName ( $ tag -> getName ( ) ) ; } return parent :: add ( $ tag ) ; }
Adds a new Tag on Dockblock .
3,518
public function sortAsc ( ) { $ cmp = function ( TagInterface $ a , TagInterface $ b ) { if ( $ a -> getName ( ) == $ b -> getName ( ) ) { return 0 ; } return ( $ a -> getName ( ) < $ b -> getName ( ) ) ? - 1 : 1 ; } ; usort ( $ this -> elements , $ cmp ) ; }
Sort the list by elements .
3,519
protected function initialize ( ) { $ xmlConfig = simplexml_load_file ( $ this -> configFilePath ) ; $ this -> wurflFile = $ this -> wurflFile ( $ xmlConfig -> xpath ( '/wurfl-config/wurfl/main-file' ) ) ; $ this -> wurflPatches = $ this -> wurflPatches ( $ xmlConfig -> xpath ( '/wurfl-config/wurfl/patches/patch' ) ) ;...
Initialize XML Configuration
3,520
private function wurflPatches ( $ patchElements ) { $ patches = array ( ) ; if ( $ patchElements ) { foreach ( $ patchElements as $ patchElement ) { $ patches [ ] = parent :: getFullPath ( ( string ) $ patchElement ) ; } } return $ patches ; }
Returns an array of full path WURFL patches
3,521
private function capabilityFilter ( $ capabilityFilter ) { $ filter = array ( ) ; if ( $ capabilityFilter ) { foreach ( $ capabilityFilter as $ filterElement ) { $ filter [ ] = ( string ) $ filterElement ; } } return $ filter ; }
Returns an array of WURFL Capabilities
3,522
private function matchMode ( $ modeElement ) { if ( ! empty ( $ modeElement ) ) { $ mode = $ modeElement [ 0 ] ; if ( ! $ mode ) { return $ this -> matchMode ; } if ( ! self :: validMatchMode ( $ mode ) ) { throw new WURFL_WURFLException ( 'Invalid Match Mode: ' . $ mode ) ; } $ this -> matchMode = $ mode ; } return $ ...
Returns the mode of operation if set otherwise null
3,523
private function persistence ( $ persistenceElement ) { $ persistence = array ( ) ; if ( $ persistenceElement ) { $ persistence [ 'provider' ] = ( string ) $ persistenceElement [ 0 ] -> provider ; $ persistence [ 'params' ] = $ this -> _toArray ( ( string ) $ persistenceElement [ 0 ] -> params ) ; } return $ persistenc...
Returns persistence provider info from XML config
3,524
protected function registerPlugin ( ) { if ( ! isset ( $ this -> options [ 'id' ] ) ) { $ this -> options [ 'id' ] = $ this -> hasModel ( ) ? Html :: getInputId ( $ this -> model , $ this -> attribute ) : $ this -> getId ( ) ; } else { $ this -> setId ( $ this -> options [ 'id' ] ) ; } $ clientOptions = [ ] ; $ this ->...
Registers switchery plugin
3,525
public function getSharedTempStoreFactory ( ) { if ( empty ( $ this -> sharedTempStoreFactory ) ) { $ this -> sharedTempStoreFactory = \ Drupal :: service ( 'user.shared_tempstore' ) ; } return $ this -> sharedTempStoreFactory ; }
Gets shared tempstore factory .
3,526
protected function getLines ( ) { $ ret = file ( $ this -> fileName ) ; if ( $ ret === false ) { throw new Exception ( 'Unable to read file' ) ; } $ lines = array ( ) ; foreach ( $ ret as $ line ) { $ lines [ ] = rtrim ( $ line ) ; } return $ lines ; }
get an array of all lines in this file
3,527
public static function collection ( $ records = [ ] , Fields $ fields = null , $ flags = Resource :: PARSE_DEFAULT ) { return Resource :: parseFromRecords ( $ records , static :: class , $ fields , $ flags ) ; }
Prepare a collection of resources
3,528
public static function resource ( $ record , Fields $ fields = null , $ flags = Resource :: PARSE_DEFAULT ) { return Resource :: parseFromRecord ( $ record , static :: class , $ fields , $ flags ) ; }
Prepare an individual resource
3,529
public static function post ( $ attributes , $ return = \ Phramework \ Database \ Operations \ Create :: RETURN_ID ) { return \ Phramework \ Database \ Operations \ Create :: create ( $ attributes , static :: getTable ( ) , static :: getSchema ( ) , $ return ) ; }
Create a record in database
3,530
public static function patch ( $ id , $ attributes ) { static :: invalidateCache ( $ id ) ; return \ Phramework \ Database \ Operations \ Update :: update ( $ id , ( array ) $ attributes , ( static :: getSchema ( ) === null ? static :: getTable ( ) : [ 'table' => static :: getTable ( ) , 'schema' => static :: getSchema...
Update selected attributes of a database record
3,531
public static function delete ( $ id , $ additionalAttributes = null ) { static :: invalidateCache ( $ id ) ; return \ Phramework \ Database \ Operations \ Delete :: delete ( $ id , ( $ additionalAttributes !== null ? ( array ) $ additionalAttributes : [ ] ) , ( static :: getSchema ( ) === null ? static :: getTable ( )...
Delete a database record
3,532
public static function convertDateRepetitionToString ( DateRepetition $ dateRepetition ) { $ dateString = '' ; if ( $ dateRepetition instanceof HourlyDateRepetition ) { $ prefix = 'hourly' ; $ timeString = ' at minute ' . $ dateRepetition -> getMinute ( ) ; } if ( $ dateRepetition instanceof DailyDateRepetition ) { $ p...
converts DateRepetition to a string accepted by newDateRepetitionFromString
3,533
public function toHArray ( $ delim = '' , $ limit = null ) { if ( empty ( $ this -> str ) ) { return new HArray ( ) ; } $ arr = new StringToArray ( $ this -> str , $ delim ) ; return new HArray ( $ arr -> stringToArray ( $ limit ) ) ; }
Alias to PHP function explode
3,534
private function getMigrationFileContents ( $ class_name ) { $ namespace = $ this -> getNamespace ( ) ; $ contents = [ '<?php' , '' , ] ; if ( $ header_comment = $ this -> getHeaderComment ( ) ) { $ contents [ ] = '/*' ; $ contents = array_merge ( $ contents , array_map ( function ( $ line ) { if ( $ line ) { return ' ...
Generate migration class contents .
3,535
public function setSettings ( array $ settings ) { $ this -> settings = $ settings ; $ hosts = \ ECL \ Util :: get ( $ settings , 'hosts' , [ ] ) ; $ index_hosts = \ ECL \ Util :: get ( $ settings , 'index_hosts' , [ ] ) ; $ ssl_cert = \ ECL \ Util :: get ( $ settings , 'ssl_cert' , null ) ; $ ssl_client_key = \ ECL \ ...
Set the current list of settings .
3,536
private function constructQueryBody ( \ ECL \ SymbolTable $ table , array $ filters , \ ECL \ Command \ Elasticsearch \ Agg $ agg = null , $ fields = null , $ sort = null , $ size = null , $ date_field = null , $ from = null , $ to = null ) { $ query_body = [ 'size' => 100 , 'query' => [ 'bool' => [ 'filter' => $ this ...
Construct the query body .
3,537
public function matchMode ( $ mode ) { if ( ! self :: validMatchMode ( $ mode ) ) { throw new WURFL_WURFLException ( 'Invalid Match Mode: ' . $ mode ) ; } $ this -> matchMode = $ mode ; return $ this ; }
Sets the API match mode
3,538
protected function buildStored ( ) { return $ this -> files -> exists ( $ file_path = $ this -> config [ 'build_metadata_path' ] ) ? $ this -> files -> get ( $ file_path , $ this -> use_locking ) : null ; }
Get build value from metadata file .
3,539
protected function forgetFormatted ( ) { if ( $ this -> files -> exists ( $ compiled_path = $ this -> config [ 'compiled_path' ] ) ) { return $ this -> files -> delete ( $ compiled_path ) ; } return false ; }
Forget stored formatted value .
3,540
private function _checkPermission ( $ name , $ attribute ) { if ( $ name == 'store' ) { return $ this -> permissionStore ( $ attribute ) ; } if ( $ name == 'update' ) { return $ this -> permissionUpdate ( $ attribute ) ; } if ( $ name == 'delete' ) { return $ this -> permissionDelete ( $ attribute ) ; } if ( $ name == ...
Check permission by name
3,541
private function _checkOption ( $ name ) { if ( $ name == 'list' ) return true ; $ names = [ 'store' => 'add' , 'update' => 'edit' , 'delete' => 'delete' , 'order' => 'order' , 'export' => 'export' ] ; return $ this -> crudeSetup -> haveOption ( $ names [ $ name ] ) ; }
Check option by name
3,542
protected function validateCommon ( $ value , $ validateResult ) { if ( $ validateResult -> status === true && $ this -> enum ) { $ validateResult = $ this -> validateEnum ( $ value , $ validateResult -> value ) ; if ( $ validateResult -> status !== true ) { return $ validateResult ; } } if ( $ validateResult -> status...
Common helper method to validate against all common keywords
3,543
protected function validateEnum ( $ value , $ parsedValue ) { $ return = new ValidateResult ( $ parsedValue , false ) ; if ( $ this -> enum !== null ) { if ( is_object ( $ value ) ) { throw new \ Exception ( 'Objects are not supported' ) ; } foreach ( $ this -> enum as $ v ) { if ( is_object ( $ v ) ) { throw new \ Exc...
Common helper method to validate against enum keyword
3,544
protected function validateNot ( $ value , $ parsedValue ) { $ return = new ValidateResult ( $ parsedValue , true ) ; if ( $ this -> not && $ this -> not !== null ) { if ( ! is_subclass_of ( $ this -> not , BaseValidator :: class , true ) ) { throw new \ Exception ( sprintf ( 'Property "not" MUST extend "%s"' , BaseVal...
Common helper method to validate against not keyword
3,545
public static function registerValidator ( $ type , $ className ) { if ( ! is_string ( $ type ) ) { throw new \ Exception ( '"type" MUST be string' ) ; } if ( ! is_string ( $ className ) ) { throw new \ Exception ( '"className" MUST be string' ) ; } if ( ! is_subclass_of ( $ className , BaseValidator :: class , true ) ...
Register a custom validator for a type
3,546
protected static function createFromObjectForAdditional ( $ object ) { $ indexProperty = null ; $ class = null ; if ( property_exists ( $ object , 'anyOf' ) ) { $ indexProperty = 'anyOf' ; $ class = AnyOf :: class ; } elseif ( property_exists ( $ object , 'allOf' ) ) { $ indexProperty = 'allOf' ; $ class = AllOf :: cla...
Helper method . Used to create anyOf allOf and oneOf validators from objects
3,547
public static function createFromObject ( $ object ) { $ isFromBase = ( static :: class === self :: class ) ; if ( ! is_object ( $ object ) ) { throw new \ Exception ( 'Expecting an object' ) ; } if ( property_exists ( $ object , 'type' ) && ! empty ( $ object -> type ) ) { if ( array_key_exists ( $ object -> type , se...
Create validator from validation object
3,548
public static function createFromJSON ( $ json ) { $ object = json_decode ( $ json ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new \ Exception ( 'JSON parse had errors - ' . json_last_error_msg ( ) ) ; } return static :: createFromObject ( $ object ) ; }
Create validator from validation object encoded as json object
3,549
public function toJSON ( $ JSON_PRETTY_PRINT = false ) { $ object = $ this -> toObject ( ) ; return json_encode ( $ object , ( $ JSON_PRETTY_PRINT ? JSON_PRETTY_PRINT : 0 ) ) ; }
Export validator to json encoded string
3,550
public function toObject ( ) { $ object = $ this -> toArray ( ) ; if ( isset ( $ object [ 'properties' ] ) ) { $ object [ 'properties' ] = ( object ) $ object [ 'properties' ] ; } foreach ( [ 'anyOf' , 'allOf' , 'oneOf' , 'not' ] as $ property ) { if ( isset ( $ object [ $ property ] ) ) { foreach ( $ object [ $ proper...
Export validator to object
3,551
public function toArray ( ) { $ object = [ ] ; if ( static :: $ type ) { $ object [ 'type' ] = static :: $ type ; } $ attributes = array_merge ( static :: getTypeAttributes ( ) , static :: $ commonAttributes ) ; foreach ( $ attributes as $ attribute ) { $ value = $ this -> { $ attribute } ; if ( $ value !== null ) { $ ...
Export validator to array
3,552
public function sendVerificationLink ( CanVerifyEmailContract $ user , Closure $ callback = null ) { $ token = $ this -> tokens -> create ( $ user ) ; $ this -> emailVerificationLink ( $ user , $ token , $ callback ) ; return VerifyEmailBrokerContract :: VERIFY_LINK_SENT ; }
Send an email verification link to a user .
3,553
public function verify ( CanVerifyEmailContract $ user , $ token ) { $ user = $ this -> validateVerification ( $ user , $ token ) ; if ( ! $ user instanceof CanVerifyEmailContract ) { return $ user ; } $ this -> tokens -> delete ( $ token ) ; $ user -> setVerified ( true ) ; $ user -> save ( ) ; return VerifyEmailBroke...
Verify the email address for the given token .
3,554
protected function validateVerification ( CanVerifyEmailContract $ user , $ token ) { if ( ! $ this -> tokens -> exists ( $ user , $ token ) ) { return VerifyEmailBrokerContract :: INVALID_TOKEN ; } return $ user ; }
Validate a verification for the given credentials .
3,555
protected function runSeeder ( $ module = null , $ database = null ) { $ this -> call ( 'pluggables:seed' , [ 'pluggable' => $ this -> argument ( 'pluggable' ) , '--database' => $ database , ] ) ; }
Run the module seeder command .
3,556
public function verifyEmailAction ( ) { $ userId = $ this -> params ( ) -> fromRoute ( 'userId' , null ) ; $ token = $ this -> params ( ) -> fromRoute ( 'token' , null ) ; if ( $ userId === null || $ token === null ) { return $ this -> notFoundAction ( ) ; } $ user = $ this -> getUserMapper ( ) -> findById ( $ userId )...
Verifies user s email address and redirects to login route
3,557
public function setPasswordAction ( ) { $ userId = $ this -> params ( ) -> fromRoute ( 'userId' , null ) ; $ token = $ this -> params ( ) -> fromRoute ( 'token' , null ) ; if ( $ userId === null || $ token === null ) { return $ this -> notFoundAction ( ) ; } $ user = $ this -> getUserMapper ( ) -> findById ( $ userId )...
Allows users to set their account password
3,558
public function buildLoader ( ContainerBuilder $ container ) { return new YamlFileLoader ( $ container , new FileLocator ( $ this -> dir . $ this -> prefix ) ) ; }
the buildLoader returns the required FileLoader .
3,559
protected function writeClass ( ClassGenerator $ class , Filesystem $ filesystem , $ destinationDir ) { $ className = $ class -> getName ( ) ; $ file = new FileGenerator ( [ 'fileName' => $ className . '.php' , 'classes' => [ $ class ] , ] ) ; $ contents = $ file -> generate ( ) ; $ relativePath = $ destinationDir . DI...
Function writeClass .
3,560
protected function validateFileContents ( ) { if ( ! $ this -> fileName ) { throw new \ LogicException ( "Missing file's path. Looks like severe internal error." ) ; } $ this -> validateFilePath ( $ this -> fileName ) ; if ( ! $ this -> sha1hash ) { throw new \ LogicException ( "Missing file's SHA1 hash. Looks like sev...
Uses SHA1 hash to determine if file contents has changed since analysis .
3,561
protected function validateFilePath ( $ fileName ) { if ( ! file_exists ( $ fileName ) ) { throw new IOException ( "File $fileName does not exists" ) ; } if ( ! is_file ( $ fileName ) ) { throw new IOException ( "$fileName must be a file" ) ; } if ( ! is_readable ( $ fileName ) ) { throw new IOException ( "File $fileNa...
Checks if file exists and is readable .
3,562
private function computeNestingParentTokens ( $ debug = false ) { $ nesting = 0 ; $ parents = array ( ) ; $ lastParent = null ; foreach ( $ this -> tokens as $ key => $ token ) { if ( is_array ( $ token ) ) { $ parent = $ parents ? $ parents [ count ( $ parents ) - 1 ] : null ; $ this -> tokens [ $ key ] [ 3 ] = $ pare...
Compute parents of the tokens to easily determine containing methods and classes .
3,563
public function getView ( $ name , $ data = [ ] ) { $ view = 'missing-page' ; if ( view ( ) -> exists ( 'page::' . $ name ) ) { $ view = $ name ; } return view ( 'page::' . $ view , $ data ) ; }
Search and Load the view or fallbacks to specific view
3,564
public function validate ( $ cpf ) { $ raw_cpf = $ cpf ; $ cpf = $ this -> clean ( $ cpf ) ; $ has_mask = preg_match ( "/^[0-9]{3}\.[0-9]{3}\.[0-9]{3}\-[0-9]{2}$/" , $ raw_cpf ) ; if ( ! $ has_mask && ! is_numeric ( $ raw_cpf ) ) { return false ; } if ( ! $ this -> isLengthValid ( $ cpf ) ) { return false ; } elseif ( ...
Validate a given Brazilian CPF number
3,565
public function isDummyValue ( $ cpf ) { return ( $ cpf == '00000000000' || $ cpf == '11111111111' || $ cpf == '22222222222' || $ cpf == '33333333333' || $ cpf == '44444444444' || $ cpf == '55555555555' || $ cpf == '66666666666' || $ cpf == '77777777777' || $ cpf == '88888888888' || $ cpf == '99999999999' ) ; }
Check if a given CPF value is a dummy sequence
3,566
public function addElement ( \ FrenchFrogs \ Form \ Element \ Element $ element , FrenchFrogs \ Renderer \ Renderer $ renderer = null ) { $ element -> setForm ( $ this ) ; $ this -> elements [ $ element -> getName ( ) ] = $ element ; return $ this ; }
Add a single element to the elements container
3,567
public function addDateRange ( $ name , $ label = '' , $ from = '' , $ to = '' , $ is_mandatory = true ) { $ e = new \ FrenchFrogs \ Form \ Element \ DateRange ( $ name , $ label , $ from , $ to ) ; $ this -> addElement ( $ e ) ; if ( $ is_mandatory ) { $ e -> addRule ( 'required' ) ; } else { $ e -> addFilter ( 'nulla...
Add 2 input for a date range element
3,568
public function addTextarea ( $ name , $ label = '' , $ is_mandatory = true ) { $ e = new \ FrenchFrogs \ Form \ Element \ Textarea ( $ name , $ label ) ; $ this -> addElement ( $ e ) ; if ( $ is_mandatory ) { $ e -> addRule ( 'required' ) ; } else { $ e -> addFilter ( 'nullable' ) ; } return $ e ; }
Add textarea element
3,569
public function addSubmit ( $ name , $ attr = [ ] ) { $ e = new \ FrenchFrogs \ Form \ Element \ Submit ( $ name , $ attr ) ; $ e -> setValue ( $ name ) ; $ e -> setOptionAsPrimary ( ) ; $ this -> addAction ( $ e ) ; return $ e ; }
Add action button
3,570
public function addCheckbox ( $ name , $ label = '' , $ multi = [ ] , $ attr = [ ] ) { $ e = new \ FrenchFrogs \ Form \ Element \ Checkbox ( $ name , $ label , $ multi , $ attr ) ; $ this -> addElement ( $ e ) ; return $ e ; }
Add input checkbox element
3,571
public function addBoolean ( $ name , $ label = '' , $ attr = [ ] ) { $ e = new \ FrenchFrogs \ Form \ Element \ Boolean ( $ name , $ label , $ attr ) ; $ this -> addElement ( $ e ) ; return $ e ; }
Add Boolean Element
3,572
public function addButton ( $ name , $ label , $ attr = [ ] ) { $ e = new \ FrenchFrogs \ Form \ Element \ Button ( $ name , $ label , $ attr ) ; $ this -> addElement ( $ e ) ; return $ e ; }
Add button element
3,573
public function addTitle ( $ name , $ attr = [ ] ) { $ e = new \ FrenchFrogs \ Form \ Element \ Title ( $ name , $ attr ) ; $ this -> addElement ( $ e ) ; return $ e ; }
Add a Title element
3,574
public function addContent ( $ label , $ value = '' , $ fullwidth = true ) { $ e = new \ FrenchFrogs \ Form \ Element \ Content ( $ label , $ value , $ fullwidth ) ; $ this -> addElement ( $ e ) ; return $ e ; }
Add format content
3,575
public function addSelect ( $ name , $ label , $ multi = [ ] , $ is_mandatory = true ) { $ e = new \ FrenchFrogs \ Form \ Element \ Select ( $ name , $ label , $ multi ) ; $ this -> addElement ( $ e ) ; if ( $ is_mandatory ) { $ e -> addRule ( 'required' ) ; } else { $ e -> addFilter ( 'nullable' ) ; } return $ e ; }
Add select element
3,576
public function addDataList ( $ name , $ label , $ options = [ ] , $ is_mandatory = true ) { $ e = new \ FrenchFrogs \ Form \ Element \ DataList ( $ name , $ label , $ options ) ; $ this -> addElement ( $ e ) ; if ( $ is_mandatory ) { $ e -> addRule ( 'required' ) ; } else { $ e -> addFilter ( 'nullable' ) ; } return $...
Add list element
3,577
public function addFile ( $ name , $ label = '' , $ is_mandatory = true ) { $ e = new \ FrenchFrogs \ Form \ Element \ File ( $ name , $ label ) ; $ this -> addElement ( $ e ) ; if ( $ is_mandatory ) { $ e -> addRule ( 'required' ) ; } else { $ e -> addFilter ( 'nullable' ) ; } return $ e ; }
Add file element
3,578
public function getArgbHexString ( Color $ color ) { $ alpha = dechex ( 255 * $ color -> alpha ) ; return '#' . $ alpha . $ color -> hex ; }
Given a Color object returns a formatted argb hex string
3,579
public function getRgbaHexString ( Color $ color ) { $ alpha = dechex ( 255 * $ color -> alpha ) ; return '#' . $ color -> hex . $ alpha ; }
Given a Color object returns a formatted rgba hex string
3,580
public function getRgbaString ( Color $ color ) { return 'rgba(' . $ color -> red . ', ' . $ color -> green . ', ' . $ color -> blue . ', ' . $ color -> alpha . ')' ; }
Given a Color object returns a formatted rgba string
3,581
public function getHslString ( Color $ color ) { return 'hsl(' . round ( $ color -> hue ) . ', ' . round ( $ color -> saturation * 100 ) . '%, ' . round ( $ color -> lightness * 100 ) . '%)' ; }
Given a Color object returns a formatted hsl string
3,582
public function getHslaString ( Color $ color ) { return 'hsla(' . round ( $ color -> hue ) . ', ' . round ( $ color -> saturation * 100 ) . '%, ' . round ( $ color -> lightness * 100 ) . '%, ' . $ color -> alpha . ')' ; }
Given a Color object returns a formatted hsla string
3,583
public function load ( Color $ color , $ value ) { $ value = strtolower ( trim ( $ value ) ) ; $ format = $ this -> guess ( $ value ) ; if ( is_callable ( __CLASS__ . '::' . $ format ) ) { $ this -> $ format ( $ color , $ value ) ; } return $ color ; }
Pass a var in subject param and this method will attempt to parse it into a color object and return it
3,584
private function guess ( $ value ) { if ( is_string ( $ value ) ) { $ len = strlen ( $ value ) ; if ( strpos ( $ value , ' ' ) === false && strpos ( $ value , ',' ) === false ) { if ( substr ( $ value , 0 , 1 ) === '#' && ( $ len === 7 || $ len === 4 ) ) { return 'loadHexString' ; } elseif ( $ len === 6 || $ len === 3 ...
Given a subject tries to discover the format then return the appropriate method name
3,585
public function loadHexString ( Color $ color , $ subject ) { $ subject = trim ( $ subject ) ; $ subject = str_replace ( array ( '#' , ';' , ' ' ) , '' , $ subject ) ; if ( strlen ( $ subject ) !== 3 && strlen ( $ subject ) !== 6 ) { return false ; } elseif ( strlen ( $ subject ) === 3 ) { $ subject = $ subject [ 0 ] ....
Loads a color object from a hex string
3,586
public function loadRgbString ( Color $ color , $ subject ) { $ subject = trim ( $ subject ) ; $ subject = str_replace ( array ( 'rgba' , 'rgb' , '(' , ')' , ';' , ' ' ) , '' , $ subject ) ; $ rgbnum = explode ( ',' , $ subject ) ; if ( count ( $ rgbnum ) !== 3 && count ( $ rgbnum ) !== 4 ) { return false ; } foreach (...
Loads a color object from an rgb or rgba string
3,587
public function loadHslString ( Color $ color , $ subject ) { $ subject = trim ( $ subject ) ; $ subject = str_replace ( array ( 'hsla' , 'hsl' , '(' , ')' , ';' , ' ' ) , '' , $ subject ) ; $ hslnum = explode ( ',' , $ subject ) ; if ( count ( $ hslnum ) !== 3 && count ( $ hslnum ) !== 4 ) { return false ; } foreach (...
Loads a color object from a hsl or hsla string
3,588
public function has ( $ key ) { try { $ ttlColumn = $ this -> columns [ 'ttl' ] ; return ( bool ) $ this -> db -> from ( $ this -> table ) -> where ( $ this -> columns [ 'key' ] ) -> eq ( $ this -> prefix . $ key ) -> andWhere ( function ( $ group ) use ( $ ttlColumn ) { $ group -> where ( $ ttlColumn ) -> eq ( 0 ) -> ...
Returns TRUE if the cache key exists and FALSE if not .
3,589
public function delete ( $ key ) { try { return ( bool ) $ this -> db -> from ( $ this -> table ) -> where ( $ this -> columns [ 'key' ] ) -> eq ( $ this -> prefix . $ key ) -> delete ( ) ; } catch ( PDOException $ e ) { return false ; } }
Delete a variable from the cache .
3,590
public function clear ( ) { try { $ this -> db -> from ( $ this -> table ) -> delete ( ) ; } catch ( PDOException $ e ) { return false ; } return true ; }
Clears the user cache .
3,591
public function children ( ) { if ( $ this -> collection === null ) { $ this -> initializeCollection ( $ this -> defaultChildren ( ) ) ; } return $ this -> collection ; }
Returns collection of child nodes .
3,592
public function getChildrenRecursive ( ) { $ res = new ObjectCollection ( ) ; foreach ( $ this -> children ( ) as $ child ) { $ res -> add ( $ child ) ; if ( $ child instanceof ParentNodeInterface ) { $ res -> addMany ( $ child -> getChildrenRecursive ( ) ) ; } } return $ res ; }
Returns collection containing all descendant nodes .
3,593
public static function isXhtmlRequester ( $ request ) { if ( ! isset ( $ request [ "accept" ] ) ) { return false ; } $ accept = $ request [ "accept" ] ; if ( isset ( $ accept ) ) { if ( ( strpos ( $ accept , WURFL_Constants :: ACCEPT_HEADER_VND_WAP_XHTML_XML ) !== 0 ) || ( strpos ( $ accept , WURFL_Constants :: ACCEPT_...
Checks if the requester device is xhtml enabled
3,594
public function prepareHasOneConstraintStatement ( TypeInterface $ type , HasOneAssociation $ association ) { $ result = [ ] ; $ result [ ] = 'ALTER TABLE ' . $ this -> getConnection ( ) -> escapeTableName ( $ type -> getName ( ) ) ; $ result [ ] = ' ADD CONSTRAINT ' . $ this -> getConnection ( ) -> escapeFieldName ...
Prepare has one constraint statement .
3,595
public function prepareHasAndBelongsToManyConstraintStatement ( $ type_name , $ connection_table , $ constraint_name , $ field_name ) { $ result = [ ] ; $ result [ ] = 'ALTER TABLE ' . $ this -> getConnection ( ) -> escapeTableName ( $ connection_table ) ; $ result [ ] = ' ADD CONSTRAINT ' . $ this -> getConnection ...
Prepare has and belongs to many constraint statement .
3,596
private final function setReadableWritable ( string $ mode ) { if ( self :: MODE_R === $ mode ) { $ this -> meta [ "readable" ] = true ; $ this -> meta [ "writable" ] = false ; } else if ( self :: MODE_W === $ mode || self :: MODE_A === $ mode || self :: MODE_C === $ mode || self :: MODE_X === $ mode ) { $ this -> meta...
Set stream readable and writable status
3,597
public final function getMetadata ( $ key = null ) { return isset ( $ key ) ? ( array_key_exists ( $ key , $ this -> meta ) ? $ this -> meta [ $ key ] : null ) : $ this -> meta ; }
Get stream metadata
3,598
public function sync ( Color $ firstcolor , Color $ secondcolor ) { foreach ( $ this -> colorprops as $ name ) { $ firstcolor -> $ name = $ secondcolor -> $ name ; } return $ firstcolor ; }
Sync first color with second color
3,599
public function getCssGradient ( Color $ color , $ amount = null ) { if ( self :: isLight ( $ color ) ) { $ lightColor = $ color -> hex ; $ darkColor = self :: darken ( $ color -> copy ( ) , $ amount ) -> hex ; } else { $ lightColor = self :: lighten ( $ color -> copy ( ) , $ amount ) -> hex ; $ darkColor = $ color -> ...
Returns the cross browser CSS3 gradient