public function fields($basePath = '')
    {
        $fields = [];
        foreach ($this->names() as $name) {
            $fields[$name] = null;
        }
        $names = Set::expand($fields);
        if ($basePath) {
            $parts = explode('.', $basePath);
            foreach ($parts as $part) {
                if (!isset($names[$part])) {
                    return [];
                }
                $names = $names[$part];
            }
        }
        return array_keys($names);
    }
public function fields($basePath = '')
    {
        $fields = [];
        foreach ($this->names() as $name) {
            $fields[$name] = null;
        }
        $names = Set::expand($fields);
        if ($basePath) {
            $parts = explode('.', $basePath);
            foreach ($parts as $part) {
                if (!isset($names[$part])) {
                    return [];
                }
                $names = $names[$part];
            }
        }
        return array_keys($names);
    }
public function fields ( $ basePath = '' ) { $ fields = [ ] ; foreach ( $ this -> names ( ) as $ name ) { $ fields [ $ name ] = null ; } $ names = Set :: expand ( $ fields ) ; if ( $ basePath ) { $ parts = explode ( '.' , $ basePath ) ; foreach ( $ parts as $ part ) { if ( ! isset ( $ names [ $ part ] ) ) { return [ ] ; } $ names = $ names [ $ part ] ; } } return array_keys ( $ names ) ; }
Gets all fields.

@param  String basePath The dotted base path to extract fields from.
@return array
Gets all fields .