Add asset

@param  string  $name
@param  string  $class
@param  string|null $table
@return boolean
196747
private function add(string $name, string $class, string $table = null) : bool
  {
    $migrations = ModulusCLI::$appdir . 'database' . DIRECTORY_SEPARATOR . 'migrations';
    $date = date('Y_m_d_H_i_s');
    $migration = $migrations . DIRECTORY_SEPARATOR . $date . '_' . $name . '.php';

    ModulusCLI::_dir($migrations);

    if ($table != null) {
      $content = Template::asset('migration_add_template');
      $content = str_replace('{migration_class}', $class, $content);
      $content = str_replace('{migration_name}', $name, $content);
      $content = str_replace('{table_name}', $table, $content);
    }
    else {
      $content = Template::asset('migration_template');
      $content = str_replace('{migration_class}', $class, $content);
      $content = str_replace('{migration_name}', $name, $content);
    }

    if (file_exists($migration)) {
      return false;
    }
    else {
      file_put_contents($migration, $content);
      return true;
    }
  }
241077
public function dropColumn( $table, $name )
    {
        try
        {
            $tmpTable = $table . '_old';

            $this->startTransaction();

            $this->copyTable( $table, $tmpTable, [ $name ] );

            $this->dropTable( $tmpTable );

            $this->commitTransaction();
        }
        catch ( Exception $e )
        {
            $this->rollbackTransaction();

            return FALSE;
        }

        return TRUE;
    }
882153
private static function ensurePropertyExists($class, $name)
    {
        if (!array_key_exists($name, self::$properties[$class])) {
            throw new Exceptions\UnknownPropertyException(get_called_class(), $name);
        }
    }
324865
public function addClass($class) {
        $this->setVariable(self::VIEW_MODEL_CLASS, $this->addValue($this->getVariable(self::VIEW_MODEL_CLASS), $class));
    }
787266
public function addAsset($name, $path)
    {
        if (!is_file($path)) {
            throw new \RuntimeException('The asset file "' . $path . '" does not exist.');
        }
        $this->assets[$name] = $path;
    }
1081640
public function addColumn( $table, $name, $type )
    {
        return $this->handler->addColumn( $table, $name, $type );
    }
1311595
public static function bind($name, $class=null)
    {
        if (is_array($name)) {
            self::$bind=array_merge(self::$bind, $name);
        } else {
            self::$bind[$name]=$class;
        }
    }
504728
private function _addMigrationRecord( $class )
    {
        $name = $this->db->prepareString( $class );
        $tm   = new \DateTime();
        $tm   = $tm->getTimestamp();
        
        // update migrations table with the new applied migration
        $query = "INSERT INTO $this->migrationTable 
                 ( migration_name, migration_date_applied ) VALUES ( ";
        
        $query .= "'$name', ";
        $query .= "$tm";
        
        $query .= " )";
        
        $this->db->lockTables( $this->migrationTable );
        
        $id = $this->db->insert( $query );
        
        if ( $this->verbose )
        {
            echo 'Migrating: ' . $class . PHP_EOL;
        }
        
        $this->db->unlockTables();
        
        return FALSE !== $id;
    }
109330
public function addType($name, $class)
    {
        if (!Type::hasType($name)) {
            Type::addType($name, $class);
        } else {
            Type::overrideType($name, $class);
        }
    }
263923
public static function registerAdminClass(string $name, string $class): bool
    {
        if (class_exists($class) === false) {
            return false;
        }
        if (self::$admin_classes === null) {
            self::$admin_classes = [];
        }
        $check = new ReflectionClass($class);
        if ($check->implementsInterface("TheCMSThread\\Classes\\Admin") === true) {
            self::$admin_classes[$name] = $class;
            return true;
        } else {
            return false;
        }
    }
1201100
public static function existe($name, $table = null)
    {
        $object = get_class(self::$driver);

        return $object::existe($name, $table);
    }
364550
public function newAsset($name, $group = null, $content = '')
    {
        $group = $this->detectGroup($name, $group);

        return (new Asset())
                ->setName($name)
                ->setGroup($group)
                ->setContent($content)
                ->setMimeType($this->namer->guessMimeType($name, $group))
                ->lazyLoadBy($this);
    }
81955
public function add($class = null)
        {
            $class = $this->getClass($class);

            if (!Arrays::exists($class, $this->reflections)) {
                $this->reflections[$class] = new ReflectionClass($class);
            }

            return $this;
        }
637113
public function resource($name, $class, array $abilities = null)
    {
        $abilities = $abilities ?: [
            'view'   => 'view',
            'create' => 'create',
            'update' => 'update',
            'delete' => 'delete',
        ];

        foreach ($abilities as $ability => $method) {
            $this->define($name.'.'.$ability, $class.'@'.$method);
        }

        return $this;
    }
288214
public static function registerPluginClass(string $name, string $class): bool
    {
        if (class_exists($class) === false) {
            return false;
        }
        if (self::$plugin_classes === null) {
            self::$plugin_classes = [];
        }
        $check = new ReflectionClass($class);
        if ($check->implementsInterface("TheCMSThread\\Classes\\Plugin") === true) {
            self::$plugin_classes[$name] = $class;
            return true;
        } else {
            return false;
        }
    }
852718
public function add($name, $class)
    {
        $ref = new ReflectionClass($class);
        if ($ref->isSubclassOf('Phalcon\Config') === false) {
            throw new NotFoundTrueParentClassException(
                $class . ' is\'t subclass of Phalcon/Config'
            );
        }
        $this->adapters[$name] = $class;
    }
543179
public function createResource($class, $name)
    {
        $entity = new $class();

        if ($entity instanceof AbstractResource) {
            $entity->setName($name);

            return $entity;
        }

        throw new WrongClassException(
            "{$class} doesn't extend Claroline\\CoreBundle\\Entity\\Resource\\AbstractResource."
        );
    }