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 ClassSearcher {
 4: 
 5:     /**
 6:      * 
 7:      * @param string $path
 8:      * @return string[]
 9:      */
10:     public static function findClasses($path) {
11:         $classes = array();
12:         foreach (CakePlugin::loaded() as $plugin) {
13:             $classes = array_merge(
14:                     $classes,
15:                     self::_findClassesOnPlugin($plugin,
16:                             CakePlugin::path($plugin), $path)
17:             );
18:         }
19:         return array_merge(
20:                 $classes, self::_findClassesOnPlugin(false, APP, $path)
21:         );
22:     }
23: 
24:     /**
25:      * 
26:      * @param string $path
27:      * @return object[]
28:      */
29:     public static function findInstances($path) {
30:         $instances = array();
31:         foreach(self::findClasses($path) as $className => $path) {
32:             $instances[] = self::_createInstance($className, $path);
33:         }
34:         return $instances;
35:     }
36:     
37:     /**
38:      * 
39:      * @param string $path
40:      * @param string $className
41:      * @return object
42:      * @throws Exception
43:      */
44:     public static function findInstance($path, $className) {
45:         $classes = self::findClasses($path);
46:         if (empty($classes[$className])) {
47:             throw new Exception("Class \"$className\" not found");
48:         } else {
49:             return self::_createInstance($className, $classes[$className]);
50:         }
51:     }
52: 
53:     /**
54:      * 
55:      * @param string $path
56:      * @param string $className
57:      * @return object
58:      * @deprecated Uses ClassSearcher::findInstance().
59:      */
60:     public static function findInstanceAndInstantiate($path, $className) {
61:         return self::findInstance($path, $className);
62:     }
63:     
64:     /**
65:      * 
66:      * @param string $className
67:      * @param string $path
68:      * @return object
69:      */
70:     private static function _createInstance($className, $path) {
71:         App::uses($className, $path);
72:         return new $className();
73:     }
74: 
75:     /**
76:      * 
77:      * @param string $pluginName
78:      * @param string  $pluginRoot
79:      * @param string $path
80:      * @return array
81:      */
82:     public static function _findClassesOnPlugin($pluginName, $pluginRoot, $path) {
83:         $fileSystemPath = $pluginRoot . implode(DS, explode('/', $path));
84:         if (!is_dir($fileSystemPath)) {
85:             return array();
86:         }
87:         $dir = new DirectoryIterator($fileSystemPath);
88:         $classes = array();
89:         while ($dir->valid()) {
90:             if ($dir->isFile() && $dir->getExtension() == 'php') {
91:                 $classes[$dir->getBasename('.' . $dir->getExtension())] = ($pluginName ? $pluginName . '.' : '') . $path;
92:             }
93:             $dir->next();
94:         }
95:         return $classes;
96:     }
97: 
98: }
99: 
API documentation generated by ApiGen 2.8.0