Version: current

# Class ClassInfo

Provides introspection information about the class tree. It's a cached wrapper around the built-in class functions. Sapphire uses class introspection heavily and without the caching it creates an unfortunate performance hit.

Package: sapphire\core
Used by: ``ViewableData::CSSClasses()``
Located at sapphire/core/ClassInfo.php

## Methods summary

`public static` | # `allClasses( )`
`public static` | # `exists( mixed $class )`
`public static` | # `hasTable( mixed $class )`
`public static` | # `reset_db_cache( )`
`public static` | # `getValidSubClasses( )` Returns the manifest of all classes which are present in the database. Returns the manifest of all classes which are present in the database.
`public static array` | # `dataClassesFor( mixed $class )` Return the database tables linked to this class. Gets an array of the current class, it subclasses and its ancestors. It then filters that list to those with DB tables Return the database tables linked to this class. Gets an array of the current class, it subclasses and its ancestors. It then filters that list to those with DB tables #### Parameters $class mixed $class string of the classname or instance of the class #### Returns `array` array
`public static array` | # `baseDataClass( mixed $class )` Return the root data class for that class. This root table has a lot of special use in the DataObject system. Return the root data class for that class. This root table has a lot of special use in the DataObject system. #### Parameters $class mixed $class string of the classname or instance of the class #### Returns `array` array
`public static array` | # `subclassesFor( mixed $class )` Returns a list of classes that inherit from the given class. The resulting array includes the base class passed through the $class parameter as the first array value. Returns a list of classes that inherit from the given class. The resulting array includes the base class passed through the $class parameter as the first array value. Example usage:
    ClassInfo::subclassesFor('BaseClass');
            array(
            0 => 'BaseClass',
            'ChildClass' => 'ChildClass',
            'GrandChildClass' => 'GrandChildClass'
    )
#### Parameters $class mixed $class string of the classname or instance of the class #### Returns `array` Names of all subclasses as an associative array.
`public static` | # `ancestry( mixed $class, mixed $onlyWithTables = false )`
`public static array` | # `implementorsOf( mixed $interfaceName )` #### Returns `array` A self-keyed array of class names. Note that this is only available with Silverstripe classes and not built-in PHP classes.
`public static` | # `classImplements( mixed $className, mixed $interfaceName )` Returns true if the given class implements the given interface Returns true if the given class implements the given interface
`public static` | # `is_subclass_of( mixed $subclass, mixed $parentClass )` Returns true if $subclass is a subclass of $parentClass. Identical to the PHP built-in function, but faster. Returns true if $subclass is a subclass of $parentClass. Identical to the PHP built-in function, but faster.
`public static array` | # `classes_for_file( string $filePath )` Get all classes contained in a file. Get all classes contained in a file. #### Parameters $filePath string $filePath Path to a PHP file (absolute or relative to webroot) #### Returns `array` array #### Uses ``ManifestBuilder``
`public static array` | # `classes_for_folder( string $folderPath )` Returns all classes contained in a certain folder. Returns all classes contained in a certain folder. #### Parameters $folderPath string $folderPath Relative or absolute folder path #### Returns `array` Array of class names
`public static` | # `ready( )` #### Deprecated Use Security::database_is_ready() instead.

### Magic methods summary

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -