idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
47,000
public static function generate ( ) { $ oDb = Factory :: service ( 'PDODatabase' ) ; $ oSettingsService = Factory :: service ( 'AppSetting' ) ; $ oModel = Factory :: model ( 'Blog' , 'nails/module-blog' ) ; $ aRoutes = [ ] ; $ oRows = $ oDb -> query ( 'SELECT id FROM ' . $ oModel -> getTableName ( ) ) ; if ( ! $ oRows ...
Returns an array of routes for this module
47,001
public function defaultAction ( ) { $ em = $ this -> getEntityManager ( ) ; $ pagerParams = [ 'itemsCountPerPage' => static :: ITEMS_ON_PAGE , 'sort' => Application :: getRequest ( ) -> getSort ( ) , ] ; $ repository = $ em -> getRepository ( $ this -> entityName ) ; $ grid = new \ Cmf \ Component \ Grid ( [ 'fields' =...
Default CRUD action . Show list of items .
47,002
public function creationOkAction ( ) { $ lng = \ Cmf \ Language \ Factory :: get ( $ this ) ; HelperFactory :: getMessageBox ( ) -> addMessage ( $ lng [ self :: MSG_CREATION_OK ] ) ; return $ this -> forward ( 'default' ) ; }
Creation of a new item is successfully
47,003
public function editionOkAction ( ) { $ lng = \ Cmf \ Language \ Factory :: get ( $ this ) ; HelperFactory :: getMessageBox ( ) -> addSuccessMessage ( $ lng [ self :: MSG_EDITION_OK ] ) ; return $ this -> forward ( 'default' ) ; }
Edition of a item is successfully
47,004
public function deletingOkAction ( ) { $ lng = \ Cmf \ Language \ Factory :: get ( $ this ) ; HelperFactory :: getMessageBox ( ) -> addMessage ( $ lng [ self :: MSG_DELETING_OK ] ) ; return $ this -> forward ( 'default' ) ; }
Deleting of a item is successfully
47,005
public function addInput ( $ fieldset , $ type , $ id = '' , $ class = '' , $ attributes = '' , $ name = '' , $ value = '' , $ placeholder = '' , $ labelText = '' , $ labelId = '' , $ labelClass = '' , $ labelAttributes = '' , $ div = FALSE , $ divId = '' , $ divClass = '' , $ divAttributes = '' ) { $ this -> formData ...
With this function you add Input elements to the form
47,006
public function addFieldset ( $ name , $ legend , $ fieldsetId = '' , $ fieldsetClass = '' , $ fieldsetAttributes = '' , $ legendId = '' , $ legendClass = '' , $ legendAttributes = '' ) { $ this -> fieldsetData [ $ this -> nrFieldset ] [ 'name' ] = $ name ; $ this -> fieldsetData [ $ this -> nrFieldset ] [ 'legend' ] =...
With this function you add a fieldset to your form
47,007
public function createForm ( $ name , $ action = '' , $ method = 'post' , $ id = '' , $ class = '' , $ attributes = '' ) { $ formOutput = '' ; foreach ( $ this -> fieldsetData as $ fieldData ) { $ formOutput .= $ this -> fieldset ( 'open' , $ fieldData [ 'fieldsetId' ] , $ fieldData [ 'fieldsetClass' ] , $ fieldData [ ...
Use this function to create the form from the configured input and fieldset data
47,008
private function fixInputAttributes ( & $ field ) { if ( is_array ( $ field [ 'attributes' ] ) ) { $ field [ 'attributes' ] [ 'placeholder' ] = $ field [ 'placeholder' ] ; } else { $ field [ 'attributes' ] .= sprintf ( ' placeholder="%s"' , $ field [ 'placeholder' ] ) ; $ field [ 'attributes' ] = trim ( $ field [ 'attr...
Adds the placeholder to the attributes with string or array detection of attributes
47,009
public static function dump ( $ data , int $ deep = 10 ) { if ( -- $ deep < 0 ) return '...' ; else if ( ! Collection :: is ( $ data ) ) return $ data ; else { $ _data = Collection :: copy ( $ data , false ) ; if ( is_object ( $ data ) && ! ( $ data instanceof \ StdClass ) ) try { if ( \ method_exists ( $ data , '__deb...
Preprocess the data before log it
47,010
public function nestedWhere ( string $ column , \ Closure $ nested , string $ lOpr = "IN" ) : self { $ this -> qBuilder -> nestedWhere ( $ column , $ nested , $ lOpr , "AND" ) ; return $ this ; }
Where Nested Select
47,011
public function join ( string $ table , string $ type = "INNER JOIN" ) : self { $ this -> qBuilder -> join ( $ table , $ type ) ; return $ this ; }
Add table to join
47,012
public function joinCond ( string $ primKey , string $ forKey , string $ cOpr = "=" ) : self { $ this -> qBuilder -> joinCond ( $ primKey , $ forKey , $ cOpr , "AND" ) ; return $ this ; }
Add join condition
47,013
protected function setSoftDelete ( ) { $ softDelete = $ this -> config [ "database.softDelete" ] ; $ this -> softDelete = $ softDelete [ "enabled" ] ?? false ; $ this -> delCol = $ softDelete [ "column" ] ?? "" ; $ this -> delValType = $ softDelete [ "value" ] ?? 0 ; }
Set soft deletion
47,014
protected function setTimestampConfig ( ) { $ timestamp = $ this -> config [ "database.timestamp" ] ; $ this -> timestamps = $ this -> timestamps === null ? ( $ timestamp [ "enabled" ] ?? false ) : $ this -> timestamps ; $ this -> createdColumn = $ this -> createdColumn ? : ( $ timestamp [ "createdColumn" ] ?? "created...
Set Timestamp Config
47,015
private static function generateHash ( $ value , string $ namespace = '' ) : string { if ( \ is_object ( $ value ) ) { $ value = spl_object_hash ( $ value ) ; } elseif ( \ is_array ( $ value ) ) { array_walk_recursive ( $ value , function ( & $ v ) { if ( \ is_object ( $ v ) ) { $ v = spl_object_hash ( $ v ) ; } } ) ; ...
Generates a SHA - 256 hash for the given value .
47,016
private static function flatten ( array $ array , & $ output ) : void { if ( null === $ output ) { $ output = [ ] ; } foreach ( $ array as $ key => $ value ) { if ( \ is_array ( $ value ) ) { self :: flatten ( $ value , $ output ) ; continue ; } $ output [ $ key ] = $ value ; } }
Flattens an array into the given output variable .
47,017
public function findPagesOfMenu ( $ menuName , $ lang = NULL ) { $ query = $ this -> getEntityManager ( ) -> createQuery ( 'SELECT p FROM FulgurioLightCMSBundle:Page p JOIN p.menu m WHERE m.label=:menuName ORDER BY m.position' ) ; $ query -> setParameter ( 'menuName' , $ menuName ) ; $ results = $ query -> getResult ( ...
Get page from a given menu name
47,018
public function upMenuPagesPosition ( $ menuName , $ position , $ positionLimit = NULL ) { if ( is_null ( $ positionLimit ) ) { $ query = $ this -> getEntityManager ( ) -> createQuery ( 'UPDATE FulgurioLightCMSBundle:PageMenu m SET m.position=m.position-1 WHERE m.position>=:position AND m.label=:menuName' ) ; } else { ...
Up pages menu position
47,019
public function getLastMenuPosition ( $ menuName ) { $ query = $ this -> getEntityManager ( ) -> createQuery ( 'SELECT MAX(m.position) FROM FulgurioLightCMSBundle:PageMenu m WHERE m.label=:menuName' ) ; $ query -> setParameter ( 'menuName' , $ menuName ) ; return $ query -> getSingleScalarResult ( ) ; }
Get last position in menu
47,020
public function getBaseUri ( ) { $ script = $ this -> get ( 'script' ) ; $ base = str_replace ( '\\' , '/' , dirname ( $ script ) ) ; if ( $ base != '/' ) { $ url = strtolower ( $ this -> get ( 'scheme' ) ) . $ this -> get ( 'name' ) . $ base ; } else { $ url = strtolower ( $ this -> get ( 'scheme' ) ) . $ this -> get ...
Get current base Uri
47,021
public function getCurrentUri ( $ absolute = true ) { if ( $ absolute ) { return $ this -> get ( 'scheme' ) . $ this -> get ( 'name' ) . $ this -> get ( 'uri' ) ; } else { return $ this -> get ( 'uri' ) ; } }
Get current uri .
47,022
public function init ( ) { $ this -> data [ 'host' ] = ( isset ( $ _SERVER [ 'HTTP_HOST' ] ) ? $ _SERVER [ 'HTTP_HOST' ] : '' ) ; $ this -> data [ 'script' ] = ( isset ( $ _SERVER [ 'SCRIPT_NAME' ] ) ? $ _SERVER [ 'SCRIPT_NAME' ] : '' ) ; $ this -> data [ 'uri' ] = ( isset ( $ _SERVER [ 'REQUEST_URI' ] ) ? $ _SERVER [ ...
Initialize Request data .
47,023
public function redirect ( $ url , $ status = 301 ) { $ status = ( int ) $ status ; if ( ! empty ( $ url ) ) { header ( $ this -> get ( 'protocol' ) . ' 301 Redirect' ) ; header ( 'Status: ' . $ status . ' Redirect' ) ; header ( 'Location: ' . $ url ) ; exit ( 0 ) ; } else { throw new \ Exception ( 'Url is empty !' ) ;...
Redirect on specified url .
47,024
public static function walkDir ( string $ path , callable $ callback ) : void { $ realPath = realpath ( $ path ) ; if ( ! is_string ( $ realPath ) || ! is_dir ( $ realPath ) ) { throw new InvalidArgumentException ( sprintf ( "Passed path \"%s\" (%s) isn't a directory" , $ path , var_export ( $ realPath , true ) ) ) ; }...
Walks directory recursively .
47,025
public static function removeDir ( string $ path ) : void { self :: walkDir ( $ path , function ( SplFileInfo $ file ) : void { $ path = $ file -> getRealPath ( ) ; $ file -> isDir ( ) ? rmdir ( $ path ) : unlink ( $ path ) ; } ) ; rmdir ( $ path ) ; }
Removes directory recursively .
47,026
public static function handle ( $ number = 0 , $ message = '' , $ file = '' , $ line = 0 , array $ context = [ ] ) { self :: $ context = $ context ; self :: $ message = $ message ; self :: $ number = $ number ; self :: $ trace = debug_backtrace ( ) ; self :: $ file = $ file ; self :: $ line = $ line ; $ level = ob_get_...
Fatal error handle
47,027
public function load ( $ configFile = null ) { $ this -> configData = json_decode ( file_get_contents ( $ this -> templateFile ) ) ; if ( $ configFile == null ) { $ configFile = $ this -> configFile ; } if ( file_exists ( $ configFile ) ) { $ configData = json_decode ( file_get_contents ( $ configFile ) ) ; if ( ! $ co...
Load or reload the configuration from the specified configuration file and template
47,028
public function save ( $ configFile = null , $ jsonOptions = 0 , $ saveUnset = false ) { if ( $ configFile == null ) { $ configFile = $ this -> configFile ; } $ data = new \ StdClass ; foreach ( $ this -> configData as $ name => $ itemData ) { if ( isset ( $ itemData -> value ) ) { ValueByPath :: setValueByPath ( $ dat...
Save the configuration to the specified configuration file
47,029
public function hasDefaultValue ( $ name ) { if ( ! $ this -> hasValue ( $ name ) ) { throw new UnknownConfigValueException ( $ name ) ; } return isset ( $ this -> configData -> { $ name } -> defaultValue ) ; }
Check whether the given configuration value has a default value .
47,030
public function getValue ( $ name ) { if ( ! $ this -> hasValue ( $ name ) ) { throw new UnknownConfigValueException ( $ name ) ; } $ itemData = $ this -> configData -> { $ name } ; if ( isset ( $ itemData -> value ) ) { return $ itemData -> value ; } if ( isset ( $ itemData -> defaultValue ) ) { return $ itemData -> d...
Get the value of the given configuration path .
47,031
public function setValue ( $ name , $ value ) { if ( ! $ this -> hasValue ( $ name ) ) { throw new UnknownConfigValueException ( $ name ) ; } $ itemData = $ this -> configData -> { $ name } ; if ( $ value === $ itemData -> defaultValue ) { unset ( $ itemData -> value ) ; } else { $ itemData -> value = $ value ; } }
Set the value of the given property path .
47,032
public function get ( $ name ) { return isset ( $ this -> collection [ $ name ] ) ? $ this -> collection [ $ name ] : null ; }
Retrieve the property definition by name .
47,033
public function import ( $ list ) { if ( ! is_array ( $ list ) && ! ( $ list instanceof Iterator ) ) { throw new InvalidArgumentException ( "Expected a list of properties and types" ) ; } foreach ( $ list as $ name => $ type ) { $ this -> add ( $ name , $ type ) ; } return $ this ; }
Add a list of properties and types
47,034
public function add ( $ name , $ type ) { $ property = clone self :: $ propertyPrototype ; $ this -> collection [ $ name ] = $ property -> setName ( $ name ) -> setRawType ( $ type ) ; return $ this ; }
Add a single property and type
47,035
public function export ( ) { $ result = array ( ) ; foreach ( $ this -> collection as $ name => $ property ) { $ result [ $ name ] = $ property -> getRawType ( ) ; } return $ result ; }
Export a list of properties and types
47,036
public function setUp ( array $ params ) { if ( ! isset ( $ params [ 'endpoint' ] ) ) { throw new \ RuntimeException ( 'Parameter "endpoint" missing.' ) ; } if ( ! isset ( $ params [ 'api_access_key' ] ) ) { throw new \ RuntimeException ( 'Parameter "api_access_key" missing.' ) ; } $ this -> params = $ params ; }
Set up the parameters .
47,037
public function listAction ( ) { $ entities = $ this -> container -> get ( "haven_web.faq.read_handler" ) -> getAll ( ) ; foreach ( $ entities as $ entity ) { $ delete_forms [ $ entity -> getId ( ) ] = $ this -> container -> get ( "haven_web.faq.form_handler" ) -> createDeleteForm ( $ entity -> getId ( ) ) -> createVie...
Finds and displays all faqs for admin .
47,038
public function get ( array $ handler , array $ settings ) { $ report = null ; $ this -> hook -> attach ( 'module.ga_report.get.before' , $ handler , $ settings , $ report , $ this ) ; if ( isset ( $ report ) ) { return $ report ; } if ( empty ( $ settings [ 'ga_profile_id' ] [ $ settings [ 'store_id' ] ] ) ) { throw n...
Returns an array of parsed reporting data
47,039
public function clearCache ( $ handler_id = null , $ store_id = null ) { $ pattern = 'ga_report.' ; if ( isset ( $ handler_id ) ) { $ pattern .= "$handler_id." ; } if ( isset ( $ store_id ) ) { $ pattern .= "$store_id" ; } $ this -> cache -> clear ( '' , array ( 'pattern' => "$pattern*" ) ) ; }
Clear cached report data
47,040
public function request ( array $ settings , array $ handler ) { if ( empty ( $ settings [ 'ga_profile_id' ] ) ) { throw new OutOfRangeException ( 'Google Analytics profile ID is empty in the request settings' ) ; } $ service = $ this -> getService ( $ settings ) ; $ request = new \ Google_Service_AnalyticsReporting_Re...
Returns an object of Google Analytics service response
47,041
protected function setRequestDate ( $ request , array $ handler ) { if ( ! empty ( $ handler [ 'query' ] [ 'date' ] ) && count ( $ handler [ 'query' ] [ 'date' ] ) == 2 ) { list ( $ from , $ to ) = $ handler [ 'query' ] [ 'date' ] ; $ date = new \ Google_Service_AnalyticsReporting_DateRange ; $ date -> setStartDate ( $...
Sets request date range
47,042
protected function setRequestMetrics ( $ request , array $ handler ) { if ( empty ( $ handler [ 'query' ] [ 'metrics' ] ) ) { throw new OutOfRangeException ( 'No query metrics data found in the handler' ) ; } $ metrics = array ( ) ; foreach ( ( array ) $ handler [ 'query' ] [ 'metrics' ] as $ i => $ name ) { $ metric =...
Sets request metrics from a handler
47,043
protected function setRequestSorting ( $ request , array $ handler ) { if ( ! empty ( $ handler [ 'query' ] [ 'sort' ] ) ) { $ orders = array ( ) ; foreach ( ( array ) $ handler [ 'query' ] [ 'sort' ] as $ field => $ params ) { $ params += array ( 'VALUE' , 'ASCENDING' ) ; list ( $ type , $ direction ) = array_map ( 's...
Sets request sorting from a handler
47,044
protected function setRequestDimensions ( $ request , array $ handler ) { if ( ! empty ( $ handler [ 'query' ] [ 'dimensions' ] ) ) { $ dimensions = array ( ) ; foreach ( ( array ) $ handler [ 'query' ] [ 'dimensions' ] as $ name ) { $ dimension = new \ Google_Service_AnalyticsReporting_Dimension ; $ dimension -> setNa...
Sets request dimensions from a handler
47,045
public function getResults ( $ response ) { $ results = array ( 'rows' => array ( ) ) ; for ( $ report_index = 0 ; $ report_index < count ( $ response ) ; $ report_index ++ ) { $ report = $ response [ $ report_index ] ; $ header = $ report -> getColumnHeader ( ) ; $ dimension_headers = $ header -> getDimensions ( ) ; $...
Returns an array of results from the response object
47,046
protected function getClient ( array $ settings ) { if ( empty ( $ settings [ 'credential_id' ] ) ) { throw new OutOfRangeException ( 'Credential ID is empty in Google client settings' ) ; } $ client = $ this -> getApiModule ( ) -> getGoogleClient ( $ settings [ 'credential_id' ] ) ; $ client -> setApplicationName ( 'A...
Returns Google Client class instance
47,047
public function deleteNodeData ( $ nodeId ) { $ query = $ this -> getEntityManager ( ) -> createQuery ( 'DELETE FROM YdleHubBundle:NodeData d WHERE d.node = :node' ) -> setParameter ( 'node' , $ nodeId ) ; return $ query -> execute ( ) ; }
Delete all data for a specific node
47,048
protected function OnSuccess ( ) { $ action = $ this -> group -> Exists ( ) ? Action :: Update ( ) : Action :: Create ( ) ; $ this -> group -> SetName ( $ this -> Value ( 'Name' ) ) ; $ this -> group -> SetCreateContainers ( ( bool ) $ this -> Value ( 'CreateContainers' ) ) ; $ this -> group -> SetCreateLayouts ( ( boo...
Saves the group and redirects to the list
47,049
public function addControl ( Control ... $ controls ) : ControlCollection { foreach ( $ controls as $ control ) { $ control -> setForm ( $ this ) ; $ this -> controls [ $ control -> getName ( ) ] = $ control ; } return $ this ; }
Add controls to form .
47,050
public function isSequence ( & $ name = null ) { if ( preg_match ( "/^nextval\\('([^']+)'::regclass\\)$/" , $ this -> data [ 'default' ] , $ matches ) ) { $ name = $ matches [ 1 ] ; return true ; } $ name = null ; return false ; }
Does this datatype link to a sequence
47,051
public function isNormalityEntity ( & $ entity = null ) { if ( $ this -> getEntity ( ) === 'normality' ) { $ entity = $ this -> data [ 'normality' ] ; return true ; } $ entity = null ; return false ; }
Does this dataType reference a normality entity?
47,052
public function isEntity ( & $ entity = null ) { if ( isset ( $ this -> data [ 'entity' ] ) ) { $ entity = $ this -> data [ 'entity' ] ; return true ; } $ entity = null ; return false ; }
Does this DataType reference a Entity?
47,053
public function isEnum ( & $ enumName = null ) { if ( isset ( $ this -> data [ 'enumName' ] ) ) { $ enumName = $ this -> data [ 'enumName' ] ; return true ; } $ enumName = null ; return false ; }
Does this dataType reference a enum?
47,054
public function hasDefault ( & $ default = null ) { if ( empty ( $ this -> data [ 'default' ] ) ) { $ default = null ; return false ; } $ default = $ this -> data [ 'default' ] ; return true ; }
Does this dataType have a default value . If so what is it .
47,055
public function serialize ( ) { $ output = array ( ) ; foreach ( $ this -> data as $ key => $ value ) { if ( ! array_key_exists ( $ key , static :: $ defaults ) or static :: $ defaults [ $ key ] !== $ value ) { $ output [ $ key ] = $ value ; } } return json_encode ( array ( $ this -> name , $ this -> entity , $ this ->...
Serialize a dataType
47,056
public static function unserialize ( $ data ) { $ data = json_decode ( $ data , true ) ; return new static ( $ data [ 0 ] , $ data [ 1 ] , $ data [ 2 ] , $ data [ 3 ] ) ; }
Unserialize a dataType
47,057
public static function makeFromAttribute ( PgAttribute $ attribute ) { $ name = $ attribute -> name ; $ entity = $ attribute -> getRelation ( ) -> getEntityName ( ) ; $ type = $ attribute -> getType ( ) ; $ fullyQualifiedName = $ attribute -> getFullyQualifiedName ( ) ; $ data = array ( 'isPrimaryKey' => $ attribute ->...
Generate a dataType from a Bond \ Pg \ Catalog \ PgAttribute
47,058
public static function makeFromRelation ( PgClass $ relation ) { $ output = array ( ) ; foreach ( $ relation -> getAttributes ( ) as $ attribute ) { $ dataType = static :: makeFromAttribute ( $ attribute ) ; $ output [ $ dataType -> name ] = $ dataType ; } return $ output ; }
Generate a array of DataTypes from a Bond \ Pg \ Catalog \ PgClass object
47,059
public function toQueryTag ( $ cast = false ) { return sprintf ( '%%%s:%s%s%%' , $ this -> name , isset ( $ this -> data [ 'enumName' ] ) ? 'text' : $ this -> data [ 'type' ] , $ this -> data [ 'isNullable' ] ? '|null' : '' , $ cast ? 'cast' : '' ) ; }
Return a query tag for use in dynamic sql .
47,060
public function getQueryModifier ( QuoteInterface $ quoting , $ cast = true ) { $ modifier = new Modifier ( $ quoting , $ this -> data [ 'type' ] , false ) ; if ( $ this -> data [ 'isNullable' ] ) { $ modifier -> add ( 'pre' , '\Bond\nullify' ) ; } if ( $ cast ) { if ( strtolower ( $ this -> data [ 'type' ] ) !== $ thi...
Get a modifier customised to work on this datatype
47,061
public function resolve ( $ template ) { foreach ( $ this as $ resolver ) { $ resource = $ resolver -> resolve ( $ template ) ; if ( ! is_null ( $ resource ) ) { return $ resource ; } } return null ; }
Returns result from first resolver that matches
47,062
public function forceFill ( array $ attributes ) { $ model = $ this ; return static :: unguarded ( function ( ) use ( $ model , $ attributes ) { return $ model -> fill ( $ attributes ) ; } ) ; }
Fill the model with an array of attributes . Force mass assignment .
47,063
public static function all ( $ columns = [ '*' ] ) { $ columns = is_array ( $ columns ) ? $ columns : func_get_args ( ) ; $ instance = new static ; return $ instance -> newQuery ( ) -> get ( $ columns ) ; }
Get all of the models from the database .
47,064
public function run ( $ action , Request $ request , Response $ response ) { $ this -> init ( ) ; if ( ! $ this -> initCalled ) { throw new IllegalStateException ( "Controller::init() must be called" ) ; } $ this -> response = $ response ; $ this -> headers = $ response -> getHeaders ( ) ; return $ this -> { $ action ....
Runs the controller .
47,065
protected static function createMenuLevel ( $ array , $ level , $ elements = [ ] , $ currentItems = [ ] , $ activeClass = 'active' , $ startLevel = 0 , $ numLevels = 2 ) { $ menu = ( $ level >= $ startLevel ? '<ul' . Link :: htmlClass ( $ elements [ 'ul_default' ] . ' ' . $ elements [ 'ul_class' ] , '' ) . Link :: html...
Creates a menu level
47,066
protected static function wrapChildren ( $ item , $ children ) { if ( ( is_string ( $ item [ 'child_wrap' ] ) || is_array ( $ item [ 'child_wrap' ] ) ) && ! empty ( $ item [ 'child_wrap' ] ) ) { return ( is_array ( $ item [ 'child_wrap' ] ) ? '<' . $ item [ 'child_wrap' ] [ 0 ] . ' class="' . $ item [ 'child_wrap' ] [ ...
Wrap any child elements in a given element
47,067
public static function build ( $ array , $ elements = [ ] , $ currentItems = [ ] , $ activeClass = 'active' , $ startLevel = 0 , $ numLevels = 2 , $ caret = false , $ linkDDExtras = false ) { if ( is_array ( $ elements ) && ! empty ( $ elements ) ) { Link :: $ linkDefaults = $ elements ; } if ( $ caret !== false && is_...
Build the navigation menu item
47,068
public function buildTag ( $ tag , $ counter , $ permalink ) { $ tagObject = new $ this -> tagEntity ( ) ; $ tagObject -> setTag ( $ tag ) ; $ tagObject -> setCounter ( $ counter ) ; $ tagObject -> setPage ( $ permalink ) ; return $ tagObject ; }
Build a Tag entity
47,069
private function setProviders ( $ providers ) { foreach ( $ providers as $ key => $ value ) { $ this -> provides [ ] = $ value ; $ this -> app -> appProviders [ ] = [ $ key => $ value ] ; } }
Set the appProviders in the main application object and set the provides array for registering the sevice providers
47,070
public function deleteItem ( $ key ) { if ( ! is_string ( $ key ) ) throw new InvalidArgumentException ( "Invalid key: " . WF :: str ( $ key ) ) ; unset ( $ this -> cache [ $ key ] ) ; return true ; }
Remove an item from the pool
47,071
public function save ( CacheItemInterface $ item ) { $ this -> cache -> set ( $ item -> getKey ( ) , $ item ) ; return $ this -> commit ( ) ; }
Save item to the pool
47,072
public function saveDeferred ( CacheItemInterface $ item ) { $ this -> cache -> set ( $ item -> getKey ( ) , $ item ) ; return true ; }
Store but do not save yet
47,073
public function write ( $ content ) { $ this -> openForWrite ( ) ; $ writtenBytes = $ this -> file -> fwrite ( $ content ) ; return $ writtenBytes ; }
Write a text
47,074
protected final function AttachError ( $ message ) { $ this -> result -> message = $ message ; $ this -> result -> success = false ; }
Attaches the exception by setting message to the result and the success flag to false
47,075
protected final function GatherOutput ( ) { \ header ( 'Content-Type: application/json' ) ; try { $ this -> output = json_encode ( $ this -> result ) ; } catch ( \ Exception $ ex ) { $ this -> AttachException ( $ ex ) ; } }
Gathers the output by encoding the result to json
47,076
public function delete ( Post $ post ) { $ response = $ this -> api -> process ( new DeletePost ( $ post ) ) ; if ( $ response -> getStatusCode ( ) == 200 ) { return true ; } else { return false ; } }
Delete a Post
47,077
public function set_xor ( Bitmask $ Binary ) { if ( ! ( $ Binary instanceof Bitmask ) ) return ; $ data = $ Binary -> get_raw ( ) ; foreach ( $ data as $ Pos => $ Byte ) $ this -> data [ $ Pos ] = @ $ this -> data [ $ Pos ] ^ $ Byte ; }
Perform xor operation with another Binary object
47,078
public function to_bin ( ) { $ out = "" ; for ( $ i = 0 ; $ i < $ this -> dataLength ( $ this -> data ) ; $ i ++ ) $ out = sprintf ( "%08b" , $ this -> data [ $ i ] ) . $ out ; return $ out ; }
return value as binary string
47,079
protected function data2hex ( $ temp ) { $ data = "" ; for ( $ i = 0 ; $ i < $ this -> dataLength ( $ temp ) ; $ i ++ ) $ data .= sprintf ( "%02X" , $ temp [ $ i ] ) ; return $ data ; }
convert array of two byte integers to high endian hexadecimal string
47,080
protected function hex2data ( $ temp ) { $ data = array ( ) ; $ len = strlen ( $ temp ) ; for ( $ i = 0 ; $ i < $ len ; $ i += 2 ) $ data [ ( int ) ( $ i / 2 ) ] = hexdec ( substr ( $ temp , $ i , 2 ) ) ; return $ data ; }
convert high endian hexadecimal string to array of two byte integers
47,081
public static function language ( string $ template ) : string { list ( $ component , $ file ) = static :: separate ( $ template ) ; $ elements = [ ENGINE_APP_ROOT , 'src' , $ component , 'Resources' , 'Language' , $ file ] ; return implode ( DIRECTORY_SEPARATOR , $ elements ) ; }
creates the fully qualified include string for a language resource file
47,082
private function getBuses ( ContainerBuilder $ container ) { $ buses = [ ] ; $ busDefinitions = $ container -> findTaggedServiceIds ( 'sokil.command_bus' ) ; foreach ( $ busDefinitions as $ busServiceId => $ busTags ) { foreach ( $ busTags as $ busTagParams ) { $ buses [ $ busServiceId ] = $ container -> findDefinition...
Get command buses
47,083
private function registerHandlersInBuses ( ContainerBuilder $ container ) { $ buses = $ this -> getBuses ( $ container ) ; $ commandHandlerDefinitions = $ container -> findTaggedServiceIds ( 'sokil.command_bus_handler' ) ; foreach ( $ commandHandlerDefinitions as $ commandHandlerServiceId => $ commandBusHandlerTags ) {...
Add handlers to command buses
47,084
public function post_async ( $ url , $ data = array ( ) ) { if ( filter_var ( $ url , FILTER_VALIDATE_URL ) === false ) { throw new \ Exception ( 'Invalid URL received by http\HttpClient' , 400 ) ; } $ paramstr = '' ; if ( ! empty ( $ data ) ) { if ( is_array ( $ data ) ) { $ paramstr = $ this -> urlencode_array ( $ da...
Make an asynchronous POST request .
47,085
public static function get_remote_filesize ( $ url , $ maxredirs = 2 ) { $ parts = parse_url ( $ url ) ; if ( empty ( $ parts [ 'host' ] ) ) { return false ; } if ( $ parts [ 'scheme' ] === 'https' ) { $ host = 'ssl://' . $ parts [ 'host' ] ; $ port = ( isset ( $ parts [ 'port' ] ) ) ? $ parts [ 'port' ] : 443 ; } else...
Gets the reported filesize of a remote object .
47,086
public function urlencode_array ( array $ ar ) { $ datastring = '' ; foreach ( $ ar as $ key => $ val ) { if ( ! empty ( $ datastring ) ) { $ datastring .= '&' ; } $ datastring .= urlencode ( $ key ) . '=' . urlencode ( $ val ) ; } return $ datastring ; }
Transforms an array of parameters into a urlencoded request string .
47,087
public function set_basic_auth ( $ username , $ password ) { $ value = 'Basic ' . base64_encode ( $ username . ':' . $ password ) ; $ this -> set_header ( 'Authorization' , $ value ) ; return true ; }
Set a basic auth header .
47,088
protected function execute_curl ( $ options ) { $ ch = curl_init ( ) ; curl_setopt_array ( $ ch , $ options ) ; $ returned = curl_exec ( $ ch ) ; $ response = HttpClientResponse :: instance_from_curl ( $ ch , $ returned ) ; curl_close ( $ ch ) ; return $ response ; }
Execute a curl call with the given options .
47,089
public static function fromNative ( ) { $ urlString = \ func_get_arg ( 0 ) ; $ user = \ parse_url ( $ urlString , PHP_URL_USER ) ; $ pass = \ parse_url ( $ urlString , PHP_URL_PASS ) ; $ host = \ parse_url ( $ urlString , PHP_URL_HOST ) ; $ queryString = \ parse_url ( $ urlString , PHP_URL_QUERY ) ; $ fragmentId = \ pa...
Returns a new Url object from a native url string
47,090
public function sameValueAs ( ValueObjectInterface $ url ) { if ( false === Util :: classEquals ( $ this , $ url ) ) { return false ; } return $ this -> getScheme ( ) -> sameValueAs ( $ url -> getScheme ( ) ) && $ this -> getUser ( ) -> sameValueAs ( $ url -> getUser ( ) ) && $ this -> getPassword ( ) -> sameValueAs ( ...
Tells whether two Url are sameValueAs by comparing their components
47,091
public function clear ( bool $ current = false ) : void { if ( $ current ) { $ this -> curr -> clear ( ) ; } $ this -> next -> clear ( ) ; }
Removes any flash values for the _next_ request optionally also in the _current_ .
47,092
public function getCurrent ( string $ name , $ alt = null ) { return $ this -> curr -> get ( $ name , $ alt ) ; }
Gets the flash value for a key in the _current_ request .
47,093
public function set ( string $ name , $ value , bool $ current = false ) : void { if ( $ current ) { $ this -> curr -> offsetSet ( $ name , $ value ) ; } $ this -> next -> offsetSet ( $ name , $ value ) ; }
Sets a flash value for the _next_ request optionally also in the _current_ request .
47,094
protected function cycle ( ) { if ( ! $ this -> moved ) { $ this -> curr -> clear ( ) ; $ this -> curr -> merge ( $ this -> next ) ; $ this -> next -> clear ( ) ; $ this -> moved = true ; } }
Transitions the values from next to current .
47,095
protected function getMessagesFromContainer ( ) { $ container = $ this -> getContainer ( ) ; $ namespaces = array ( ) ; foreach ( $ container as $ namespace => $ messages ) { if ( isset ( $ this -> messages [ $ namespace ] ) ) { $ this -> messages [ $ namespace ] = array_merge ( $ this -> messages [ $ namespace ] , $ m...
Pull messages from the session container and merge them with current messages
47,096
public function cmdGetField ( ) { $ result = $ this -> getListField ( ) ; $ this -> outputFormat ( $ result ) ; $ this -> outputFormatTableField ( $ result ) ; $ this -> output ( ) ; }
Callback for field - get command
47,097
public function cmdUpdateField ( ) { $ params = $ this -> getParam ( ) ; if ( empty ( $ params [ 0 ] ) || count ( $ params ) < 2 ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid command' ) ) ; } if ( ! is_numeric ( $ params [ 0 ] ) ) { $ this -> errorAndExit ( $ this -> text ( 'Invalid argument' ) ) ; } $ this ->...
Callback for field - update command
47,098
protected function submitAddField ( ) { $ this -> setSubmitted ( null , $ this -> getParam ( ) ) ; $ this -> validateComponent ( 'field' ) ; $ this -> addField ( ) ; }
Add a new field at once
47,099
protected function wizardAddField ( ) { $ this -> validatePrompt ( 'title' , $ this -> text ( 'Name' ) , 'field' ) ; $ this -> validateMenu ( 'type' , $ this -> text ( 'Type' ) , 'field' , $ this -> field -> getTypes ( ) ) ; $ this -> validateMenu ( 'widget' , $ this -> text ( 'Widget' ) , 'field' , $ this -> field -> ...
Add a new field step by step