Overview

Namespaces

  • Cron
  • None

Classes

  • _HtmlGrid_TableOut
  • _TransactionModel_RawSaveOperation
  • AccessControlComponent
  • AccessControlHelper
  • ActionListHelper
  • ActiveDirectoryUtils
  • AddCurrentPidToSchedulingShellCallLogs
  • AnonymousFunctionOperation
  • ArrayUtil
  • AssociationIntegrityBehavior
  • AtomicOperation
  • AuthenticationComponent
  • AuthenticationController
  • AuthenticationUser
  • AutocompleteDatasourceComponent
  • BaseModelComponent
  • Basics
  • CakeLayersHelper
  • CheckAndRunShell
  • ClassSearcher
  • CommandLineUtil
  • CommonValidationBehavior
  • ConfigurableShellCallsSchedulingTask
  • ConfigurationKey
  • ConfigurationKeys
  • ConfigurationKeysController
  • Context
  • ContextComponent
  • ContextHelper
  • Contexts
  • ControllerInspector
  • ControllerMenuHelper
  • CreateJournalingTables
  • CreateTableConfigurationKeys
  • CreateTableSchedulingConfigurableShellCalls
  • CreateTableSchedulingShellCallLogs
  • CreateTableSettedConfigurationKeys
  • CreateTableUserResetPasswordRequests
  • CreateTableUsers
  • CronSchedulingInstaller
  • CronValidationBehavior
  • CssBox
  • CssController
  • CssProperties
  • CssShell
  • CsvUtil
  • CustomDataModel
  • DatasourceDumperManager
  • DateTimeInput
  • DependencyShell
  • DetailHelper
  • DumperShell
  • ExtendedFieldsAccessControl
  • ExtendedFieldSet
  • ExtendedFieldSetHelper
  • ExtendedFieldsParser
  • ExtendedFormHelper
  • ExtendedHasManyAppModel
  • ExtendedOperationsBehavior
  • FieldDefinition
  • FieldRowDefinition
  • FieldSetDefinition
  • FieldSetLayoutHelper
  • FileOperations
  • FileOperations_Rename
  • FileOperations_SymLink
  • FileOperations_Touch
  • FileOperations_Unlink
  • FileSystem
  • FixConfigurationKeysPrimaryKey
  • FixSettedConfigurationKeysPrimaryKey
  • HasManyUtilsBehavior
  • HtmlDocument
  • HtmlGrid
  • HtmlGrid_Cell
  • HttpClient
  • HttpResponse
  • ImapClient
  • ImapMailBox
  • ImapParserShell
  • IncludePath
  • InputMasked
  • InputSearchable
  • InputsOnSubmit
  • InstallShell
  • JenkinsBuildShell
  • Journal
  • JournalDetail
  • JournalizedBehavior
  • JsonResponseComponent
  • LayoutsHelper
  • Ldap
  • LdapUtils
  • ListFieldSet
  • ListFieldSetHelper
  • ListsHelper
  • MailParser
  • Make
  • MenuHelper
  • MigrationAllPluginsShell
  • ModelOperations
  • ModelOperations_Delete
  • ModelOperations_Save
  • ModelTraverser
  • MysqlDumper
  • OpenLdapUtils
  • PaginatorUtilComponent
  • PaginatorUtilComponentFilter
  • PaginatorUtilHelper
  • Plugin
  • PluginManager
  • Reflections
  • RenameEnabledToActiveFromUsersTable
  • RunShellCallShell
  • ScaffoldUtilComponent
  • ScaffoldUtilHelper
  • Scheduling
  • SchedulingConfigurableShellCall
  • SchedulingConfigurableShellCallsController
  • SchedulingShellCallLog
  • SchedulingShellCallLogsController
  • SettedConfigurationKey
  • StuffreposPluginsRename
  • TimeZoneBehavior
  • TransactionModel
  • TransactionOperation
  • Translator
  • TranslatorShell
  • User
  • UserAuthenticationComponent
  • UserChangePassword
  • UserResetPassword
  • UserResetPasswordRequest
  • UserResetPasswordRequestSubmission
  • UsersController
  • ViewUtilHelper

Interfaces

  • AccessControlFilter
  • CommitableOperation
  • DatasourceDumper
  • MakeListener
  • SchedulingInstaller
  • TasksObject
  • UndoableOperation

Exceptions

  • LdapObjectNotWritableException
  • ModelTraverserException
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: class ArrayUtil {
  4: 
  5:     public static function hasArrayIndex($array, $index) {
  6:         try {
  7:             self::arrayIndex($array, $index, true);            
  8:             return true;
  9:         } catch (OutOfBoundsException $ex) {
 10:             return false;
 11:         }
 12:     }
 13: 
 14:     /**
 15:      * 
 16:      * @param array $array
 17:      * @param array $index
 18:      * @param boolean $required
 19:      * @return mixed
 20:      */
 21:     public static function arrayIndex($array, $index, $required = false) {
 22:         $current = $array;
 23:         foreach ($index as $i) {
 24:             if (array_key_exists($i, $current)) {
 25:                 $current = &$current[$i];
 26:             } else if ($required) {
 27:                 throw new OutOfBoundsException("Index not found: " . print_r(compact('array', 'index', 'required', 'current'), true));                
 28:             } else {
 29:                 return null;
 30:             }
 31:         }
 32: 
 33:         return $current;
 34:     }
 35: 
 36:     public static function keysAsValues($array) {
 37:         $newArray = array();
 38:         foreach ($array as $value) {
 39:             $newArray[$value] = $value;
 40:         }
 41:         return $newArray;
 42:     }
 43: 
 44:     /**
 45:      * 
 46:      * @param mixed $var
 47:      * @return array
 48:      */
 49:     public static function arraylize($var) {
 50:         if (is_array($var)) {
 51:             return $var;
 52:         }
 53: 
 54:         if ($var === false || $var === null) {
 55:             return array();
 56:         }
 57: 
 58:         return array($var);
 59:     }
 60: 
 61:     /**
 62:      *
 63:      * @param array $array
 64:      * @return array 
 65:      */
 66:     public static function array2NamedParams($array) {
 67:         $params = array();
 68:         foreach ($array as $key => $value) {
 69:             if (is_array($value)) {
 70:                 foreach (array2NamedParams($value) as $subKey => $subValue) {
 71:                     $params[$key . '.' . $subKey] = $subValue;
 72:                 }
 73:             } else {
 74:                 $params[$key] = $value;
 75:             }
 76:         }
 77:         return $params;
 78:     }
 79: 
 80:     public static function mergeArrayWithKeys($array1, $array2) {
 81:         foreach ($array2 as $key => $value) {
 82:             $array1[$key] = $value;
 83:         }
 84: 
 85:         return $array1;
 86:     }
 87: 
 88:     /**
 89:      *
 90:      * @param array $array
 91:      * @param array $index
 92:      * @param mixed $value 
 93:      */
 94:     public static function setByArray(&$array, $index, $value) {
 95:         $ref = &$array;
 96:         foreach ($index as $i) {
 97:             $ref = &$ref[$i];
 98:         }
 99: 
100:         $ref = $value;
101:     }
102: 
103:     public static function orderBy($array) {
104:         $args = func_get_args();
105:         $data = array_shift($args);
106:         foreach ($args as $n => $field) {
107:             if (is_string($field) || is_array($field)) {                
108:                 $tmp = array();
109:                 foreach ($data as $key => $row) {
110:                     $tmp[$key] = self::arrayIndex($row, self::arraylize($field));
111:                 }
112:                 $args[$n] = $tmp;
113:             }
114:         }
115:         $args[] = &$data;
116:         call_user_func_array('array_multisort', $args);
117:         return array_pop($args);
118:     }
119:     
120:     public static function keysTree($array) {
121:         $keys = array();
122:         foreach($array as $key => $value) {            
123:             if (is_array($value)) {
124:                 $keys[$key] = self::keysTree($value);
125:             }
126:             else {
127:                 $keys[$key] = gettype($value);
128:             }
129:         }
130:         return $keys;
131:     }
132: 
133: }
134: 
135: ?>
API documentation generated by ApiGen 2.8.0