j0hnys/definitions

Definitions are models of implementation

v0.1.0.0 2019-10-18 19:33 UTC

This package is auto-updated.

Last update: 2021-11-24 02:59:33 UTC


README

Definitions are models of implementation. For more info on the theory see here

Example

Having the Definition:

<?php

namespace App;

use j0hnys\Definitions\Definition;

final class Test extends Definition {
    const schema = [
        'database' => [
            'factories' => [
                'Models' => 'T::integer()',
            ],
            'generated_migrations' => 'T::string()',
            'generated_model_exports' => 'T::string()',
            'generated_models' => 'T::string()',
        ],
    ];
}

We can make the following checks that pass:

$test = new Test();

$test->checkPath('database/factories/Models/*');

$test->check([
    'database' => [
        'factories' => [
            'Models' => 1,
        ],
        'generated_migrations' => 'some',
        'generated_model_exports' => 'thing',
        'generated_models' => 'else',
    ],
]);