bear/app-meta

BEAR.Sunday application meta information

1.6.2 2020-06-23 03:59 UTC

This package is auto-updated.

Last update: 2021-01-23 05:09:20 UTC


README

Scrutinizer Code Quality Code Coverage Build Status

Application meta data value object

  • AppMeta object keep the application path such as $tmpDir, $logDir and $appDir in public property by given app name and context.

  • getGenerator() return \Generator to get resource meta data.

use BEAR\AppMeta\Meta;

$appMeta = new Meta('MyVendor\HelloWorld');

// provids directory path

// $appMeta->name;    // MyVendor\HelloWorld
// $appMeta->appDir;  // MyVendor\HelloWorld/src
// $appMeta->logDir;  // MyVendor\HelloWorld/var/log
// $appMeta->tmpDir;  // MyVendor\HelloWorld/var/tmp

// resource meta generator

foreach ($appMeta->getGenerator('*') as $resourceMeta) {
    var_dump($resourceMeta->uriPath); // app://self/one
    var_dump($resourceMeta->class);   // FakeVendor\HelloWorld\Resource\App\One
    var_dump($resourceMeta->file);    // /path/to/src/Resource/App/One.php
}

foreach ($appMeta->getGenerator('app') as $resourceMeta) {
    var_dump($resourceMeta->uriPath); // /one
    var_dump($resourceMeta->class);   // FakeVendor\HelloWorld\Resource\App\One
    var_dump($resourceMeta->file);    // /path/to/src/Resource/App/One.php
}