code/DataSource.php
public function toDBObject()
    {
        $info = pathinfo($this->path);

        switch ($info['extension']) {
            case 'yaml':
            case 'yml':
                return DBField::create_field('YAMLField', file_get_contents($this->path));
            case 'json':
                return DBField::create_field('JSONField', file_get_contents($this->path));

            default:
                return null;
        }
    }
public function toDBObject()
    {
        $info = pathinfo($this->path);

        switch ($info['extension']) {
            case 'yaml':
            case 'yml':
                return DBField::create_field('YAMLField', file_get_contents($this->path));
            case 'json':
                return DBField::create_field('JSONField', file_get_contents($this->path));

            default:
                return null;
        }
    }
public function toDBObject ( ) { $ info = pathinfo ( $ this -> path ) ; switch ( $ info [ 'extension' ] ) { case 'yaml' : case 'yml' : return DBField :: create_field ( 'YAMLField' , file_get_contents ( $ this -> path ) ) ; case 'json' : return DBField :: create_field ( 'JSONField' , file_get_contents ( $ this -> path ) ) ; default : return null ; } }
Converts the file content into a SerialisedDBField

@return SerialisedDBField|null
Converts the file content into a SerialisedDBField