src/Collection/Templates.php
public static function fromArray(array $templates): Templates
    {
        // No templates. Nothing to do.
        if (empty($templates)) {
            return new static();
        }

        $result = new static();

        foreach ($templates as $index => $template) {
            $result->add(new Template($template), $index);
        }

        return $result;
    }
public static function fromArray(array $templates): Templates
    {
        // No templates. Nothing to do.
        if (empty($templates)) {
            return new static();
        }

        $result = new static();

        foreach ($templates as $index => $template) {
            $result->add(new Template($template), $index);
        }

        return $result;
    }
public static function fromArray ( array $ templates ) : Templates { // No templates. Nothing to do. if ( empty ( $ templates ) ) { return new static ( ) ; } $ result = new static ( ) ; foreach ( $ templates as $ index => $ template ) { $ result -> add ( new Template ( $ template ) , $ index ) ; } return $ result ; }
Creates and returns the collection from given array

@param array $templates Pairs of key-value where: key - template's index, value - template's content
@return Templates
Creates and returns the collection from given array