Overview

Classes

  • Api1
  • Array1
  • ArrayObject1
  • Auth1
  • AuthModel1
  • Chat1
  • Class1
  • Color1
  • Console1
  • Controller1
  • Converter1
  • Cookie1
  • Date1
  • DateManager1
  • Db1
  • DbPref1
  • EasyBook
  • EasyCountry
  • EasyGenerator
  • EasyProduct
  • EasyProject
  • EasySchool
  • EasyStatus
  • exApiController1
  • exBlade1
  • exClass
  • exData1
  • exMail1
  • exRoute1
  • exTranslate1
  • exUrl1
  • FileManager1
  • FilePref1
  • Form1
  • Function1
  • Header1
  • Html1
  • HtmlAsset1
  • HtmlForm1
  • HtmlStyle1
  • HtmlWidget1
  • Math1
  • Model1
  • Model1FileLocator
  • Number1
  • Object1
  • Page1
  • Picture1
  • Popup1
  • QUESTION_TYPE
  • RecursiveArrayObject1
  • RegEx1
  • ResultObject1
  • ResultStatus1
  • ServerRequest1
  • Session1
  • SessionPreferenceSave1
  • String1
  • TaskManager1
  • Url1
  • Validation1
  • Value1

Interfaces

  • Controller1RouteInterface
  • Model1ActionInterface
  • Model1PageInterface

Functions

  • __
  • api_and_form_default_route
  • app
  • app_api_list
  • app_class_list
  • app_class_paths
  • app_class_with_interface
  • app_controller_list
  • app_dashboard_list
  • app_db_model_list
  • app_db_table_list
  • app_model_list
  • app_page_list
  • asset
  • csrf_token
  • current_layout_asset
  • current_plugin_asset
  • current_resources_asset_path
  • d
  • dd
  • file_base
  • file_session
  • file_session_get
  • file_session_remove
  • file_session_save
  • form_call_api
  • form_call_controller
  • form_token
  • get_all_view_in_directory
  • get_valid_view_path
  • is_token_valid
  • is_ajax_request
  • layout_asset
  • mailer
  • mailer_send_mail_to_list
  • make_default_route
  • makeRoute
  • normalizeSharedPath
  • now
  • now_date
  • now_time
  • old
  • paginate
  • path_app
  • path_asset
  • path_asset_url
  • path_clear_cache
  • path_main
  • path_main_url
  • path_shared
  • path_shared_app
  • path_shared_asset
  • path_shared_asset_url
  • path_shared_resources
  • path_to_viewpath
  • plugin_asset
  • pre
  • redirect
  • redirect_back
  • redirect_failed
  • redirect_to_view
  • register_path_for_layout_asset
  • request
  • resources_path
  • resources_path_asset
  • resources_path_cache
  • resources_path_plugin
  • resources_path_view
  • resources_path_view_cache
  • resources_path_view_layout
  • route
  • routes
  • shared_asset
  • token
  • translate_language
  • translated_language
  • url
  • view
  • view_exists
  • view_make
  • viewpath_to_path
  • Overview
  • Class

Class Array1

Located at easycore/Ehex.php
Methods summary
public static array|mixed
# makeArray( $value, null $ifNuArray_SplitWith_orNullToWrapAsArray = null )

make value array, e.g 'samson' will become ['samson'] if no param passed in for $ifNuArray_SplitWith_orNullToWrapAsArray , ignore existing array

make value array, e.g 'samson' will become ['samson'] if no param passed in for $ifNuArray_SplitWith_orNullToWrapAsArray , ignore existing array

Parameters

$value
$ifNuArray_SplitWith_orNullToWrapAsArray

Returns

array|mixed

See

Array1::toArray()
public static array|mixed
# normalizeIfSingleArray( array $arrayList )

If Array contains only Single item, return only the item

If Array contains only Single item, return only the item

Parameters

$arrayList

Returns

array|mixed
public static array|mixed
# toArray( $value, null $ifNuArray_SplitWith_orNullToWrapAsArray = null )

make value array, e.g 'samson' will become ['samson'] if no param passed in for $ifNuArray_SplitWith_orNullToWrapAsArray , ignore existing array

make value array, e.g 'samson' will become ['samson'] if no param passed in for $ifNuArray_SplitWith_orNullToWrapAsArray , ignore existing array

Parameters

$value
$ifNuArray_SplitWith_orNullToWrapAsArray

Returns

array|mixed

See

Array1::makeArray()
public static
# toObject( $value, $className = null )
public static array
# orderBy( array $items, string $keyToSortWith = 'id', string $orderType = 'asc' )

orderBy( [ ['id' => 2, 'name' => 'Joy'], ['id' => 3, 'name' => 'Khaja'], ['id' => 1, 'name' => 'Raja'] ], 'id', 'desc' ); // [['id' => 3, 'name' => 'Khaja'], ['id' => 2, 'name' => 'Joy'], ['id' => 1, 'name' => 'Raja']]

Parameters

$items
$keyToSortWith
$orderType

Returns

array
public static array
# groupBy( $items, $func )

Groups the elements of an array based on the given function. groupBy(['one', 'two', 'three'], 'strlen'); // [3 => ['one', 'two'], 5 => ['three']]

Groups the elements of an array based on the given function. groupBy(['one', 'two', 'three'], 'strlen'); // [3 => ['one', 'two'], 5 => ['three']]

Parameters

$items
$func

Returns

array
public static array
# flatten( array $items )

Flattens an array up to the one level depth. flatten([1, [2], 3, 4]); // [1, 2, 3, 4]

Flattens an array up to the one level depth. flatten([1, [2], 3, 4]); // [1, 2, 3, 4]

Parameters

$items

Returns

array
public static array
# deepFlatten( $items )

Deep flattens an array. deepFlatten([1, [2], [[3], 4], 5]); // [1, 2, 3, 4, 5]

Deep flattens an array. deepFlatten([1, [2], [[3], 4], 5]); // [1, 2, 3, 4, 5]

Parameters

$items

Returns

array
public boolean
# ifAll( $items, $functionToValidateWith )

Returns true if the provided function returns true for all elements of an array, false otherwise. all([2, 3, 4, 5], function ($item) { return $item > 1; }); // true

Returns true if the provided function returns true for all elements of an array, false otherwise. all([2, 3, 4, 5], function ($item) { return $item > 1; }); // true

Parameters

$items
$functionToValidateWith

Returns

boolean
public static string
# ifAny( $items, $functionToValidateWith )

Returns true if the provided function returns true for at least one element of an array, false otherwise. any([1, 2, 3, 4], function ($item) { return $item < 2; }); // true

Returns true if the provided function returns true for at least one element of an array, false otherwise. any([1, 2, 3, 4], function ($item) { return $item < 2; }); // true

Parameters

$items
$functionToValidateWith

Returns

string
public static string
# hashCode( $array )

Parameters

$array

Returns

string
public static
# toJSON( $array )

Convert array to JSON

Convert array to JSON

public static
# fromJSON( $array )

Load array from JSON

Load array from JSON

public static
# saveAsJSON( $array, $toFilePath = null )

Save array to JSON Path

Save array to JSON Path

See

Array1::readFromJSON()
public static boolean|mixed
# readFromJSON( null $fromFilePath = null )

Load array from JSON Path

Load array from JSON Path

Parameters

$fromFilePath

Returns

boolean|mixed

See

Array1::saveAsJSON()
public static array
# reUseValueAsKey( $valueList )

Duplicate array value as key e.g [hi, hello, thnks] = [hi=hi, hello=hello, thnks=thnks]

Duplicate array value as key e.g [hi, hello, thnks] = [hi=hi, hello=hello, thnks=thnks]

Parameters

$valueList

Returns

array
public static array
# normalizeLinearRequestList( $linearArray )

This is a type of arrey that occured in form request array of form control Example to get $_FILE['images'] as separate control, because the control name is array, you will need this

This is a type of arrey that occured in form request array of form control Example to get $_FILE['images'] as separate control, because the control name is array, you will need this

"name" => array(3) [ 0 => string(8) "logo.png" 1 => string(24) "FB_IMG_1477050973313.jpg" 2 => string(24) "FB_IMG_1477050973313.jpg" ] "type" => array(3) [ 0 => string(9) "image/png" 1 => string(10) "image/jpeg" 2 => string(10) "image/jpeg"

Parameters

$linearArray

Returns

array
public static array
# maxOrMinKeyValue( $list, string $logic = '>' )

Parameters

$list
$logic

Returns

array
public static integer
# maxOrMin( $list, string $login = '>' )

Parameters

$list
$login

Returns

integer
public static string
# implode( string $separator, $arrayList, boolean $recursive = true )

Parameters

$separator
$arrayList
$recursive

Returns

string
public static array
# fromXMLObject( $xmlObject )

Extract Array From Mark Up

Extract Array From Mark Up

Parameters

$xmlObject

Returns

array
public static SimpleXMLElement[]
# fromXML( $xml_data )

Extract Array From Mark Up

Extract Array From Mark Up

Parameters

$xml_data

Returns

SimpleXMLElement[]
public static array
# wrap( $array, string $append = '', string $prepend = '' )

Parameters

$array
array
$append
$prepend

Returns

array
Surround Array Items with Appended/Prepended Data
public static string
# getLastItem( $array )

Parameters

$array
array

Returns

string
Last Array
public static string
# getFirstItem( $array )

Parameters

$array
array

Returns

string
Last Array
public static
# pickOne( array $options )
public static string
# mergeKeyValue( array $key_and_value = [], string $keyValueDelimiter = '=', string $delimiter = ' ', string $keyWrap = "%s", string $valueWrap = "%s" )

Parameters

$key_and_value
$keyValueDelimiter
$delimiter
$keyWrap
$valueWrap

Returns

string

merger KeyValue together E.G self::mergeKeyValue($key_and_value = ['name'=>'samson', 'email'=>'sams@gmail.com'], $keyValueDelimiter = '=', $delimiter = ' , ', $keyWrap = "%s", $valueWrap = "(%s)") OUTPUT: name=(samson) , email=(sams@gmail.com)

public static string
# toHtmlAttribute( array $attributes = [], boolean $allowNumber = false )

Parameters

$attributes
$allowNumber
prevent ['class'=>'col-3', checked, food] = class='col-3' 0="checked" 1="food"

Returns

string
class="col-3" checked value="online"
public static array
# getArraysWith( string $startWith = null, null $andEndWith = null, array $arrayToSearch = [], array $except = [] )

Parameters

$startWith
Start With String
$andEndWith
$arrayToSearch
$except

Returns

array
public static array
# splitAndFilterArrayItem( $delimiter, $string )

Filter and Remove Empty Space from Array

Filter and Remove Empty Space from Array

Parameters

$delimiter
$string

Returns

array
public static array
# filterArrayItem( $array, string $callbackFilterFunction = 'strlen' )

Filter and Remove Empty Space from Array

Filter and Remove Empty Space from Array

Parameters

$array
$callbackFilterFunction

Returns

array
public static array
# sanitizeArrayItemValue( array $array_key_value = [], array $exceptKeyList = [], string $callbackSanitizeFunction = 'static::getSanitizeValue' )

Parameters

$array_key_value
$exceptKeyList
$callbackSanitizeFunction

Returns

array
Filter array Item With A Function That accept $value Parameter
public static array
# initEmptyValueTo( $arrayList, string $defaultValue = '', array $excludeKey = [] )

Filter and Remove Empty Space from Array

Filter and Remove Empty Space from Array

Parameters

$arrayList
$defaultValue
$excludeKey

Returns

array
public static array
# except( $arrayList, array $excludeKey = [] )

Remove Un wanted Key From Array

Remove Un wanted Key From Array

Parameters

$arrayList
$excludeKey

Returns

array
public static
# fillRemainingSpace( & $array, $spaceCountToFill, string $valueToFIll = ' ' )

Fill Data into array, usually useful in Table where you don't want to miss a column, and you trynna balance table rows together.

Fill Data into array, usually useful in Table where you don't want to miss a column, and you trynna balance table rows together.

Parameters

$array
$spaceCountToFill
$valueToFIll
public static
# trim( $array = [], $trimCharSet = '( )"\'' )
public static
# exists( $arrayList, $keyToSearch )
public static
# removeKeys( $array, $keysToRemoveList = [] )
public static
# replaceKeyName( $array, $oldKeyName, $newKeyName )
public static array
# replaceKeyNames( array $arrayList, array $oldName_equals_to_newName = ['oldName'=>'newName'] )

Parameters

$arrayList
of Value to replace keyName
$oldName_equals_to_newName
(Replace $arrayList KeyName with keyValue)

Returns

array
public static array
# replaceValues( $arrayList, array $oldValue_equals_to_newValues = ['one'=>'1'] )

Parameters

$arrayList
of Value to replace keyName
$oldValue_equals_to_newValues

Returns

array
public static
# containValue( $arrayList, $keyToSearch )
public static array
# contain( array $arrayList = [], array $needleListToSearch = [], boolean $recursive = false, string $searchPosition = 'contain' )

Search Array key and Value for a particular list of another array

Parameters

$arrayList
$needleListToSearch
$recursive
$searchPosition
[ could be 'contain' or 'start' or 'end']

Returns

array

See

Array1::startsWith(), @see Array1::endsWith()
public static
# startsWith( $arrayList = [], $needleListToSearch = [], $recursive = false )
public static
# endsWith( $arrayList = [], $needleListToSearch = [], $recursive = false )
public static mixed
# last( array $array = [] )

Get Last Array

Get Last Array

Parameters

$array

Returns

mixed
public static array
# removeLast( array $array = [] )

Array Pop off last Element

Array Pop off last Element

Parameters

$array

Returns

array
public static array
# removeFirst( array $array = [] )

Array Pop off first Element

Array Pop off first Element

Parameters

$array

Returns

array
public static array
# getCommonField( callable $callback, array $primaryAndCompleteArray, array $otherArray )

Parameters

$callback
$primaryAndCompleteArray
$otherArray

Returns

array

return all common field present in $primaryAndCompleteArray and $otherArrayList1, $otherArrayList2... FOR LARAVEL REQUEST VALIDATE, USE Request2::getAvailableFields();

public static string
# addSlashes( $arrayList )

Escapse Value with quote

Escapse Value with quote

Parameters

$arrayList

Returns

string
public static array
# randomElements( array $array = array('a', 'b', 'c'), integer $count = 1, boolean $allowDuplicates = false )

Parameters

$array
$count
$allowDuplicates

Returns

array
API documentation generated by ApiGen