Igor will auto-generate your interfaces files. Specify a file or directory, and voilĂ !
Yes, I know. Usually, you write your interfaces first, and generate files from them. But for odd cases or weird people, Igor is there.
composer require ssitu/igor
To uses Igor in CLI, install ssitu/euclid
too.
Check out IgorCli.php
in src/
, and bin/igor
in samples/
.
php bin/igor
And then just follow the prompts!
use SSITU\Igor\Igor;
require_once 'path/to/autoload.php';
$Igor = new Igor();
$Igor->set_intrNamespace('Castle\\MonseigneurNamespace')
->doALLtheInterfaces('classes/src/path/', 'interfaces/dest/path');
$Igor->doALLtheInterfaces($srcdir, $intfdir);
$Igor->doOneInterface($srcfile, $dest);
All setters are chainable.
$Igor->set_srcFilesGlobpattrn($pattern); // default: "*[!(_i)].php"
$Igor->set_intrFilesGlobpattrn($pattern); // default: none
$Igor->set_intrFilesSuffx($suffx); // default: "_i"
$Igor->set_intrFilesPrefx($prefx); // default: none
Manually specify License mention (1)
Or let Igor locate it in source file and copy it (2)
$Igor->set_licenseMention($mention); // (1) default: none
$Igor->set_autoSearchLicense($bool); // (2) default: true
$Igor->set_intrNamespace($intrNamespace); // default: ''
$Igor->set_addImplementsToSrc($bool); // default: true
$Igor->set_rewrite($bool); // default: true
Set interface namespace with set_intrNamespace
.
Namespace-guessing is too hazardous; better not breaking your code.
If set_addImplementsToSrc
set to true
:
Igor will add implements \InterfaceNamespace\InterfaceName
to source file, if not already set.
set_rewrite
applies to method doALLtheInterfaces
.
If set to false, Igor will skip source files that already have a matching interface file.
Otherwise, said existing interface file will be rewritten from sratch.
Sure! You can take a loot at CONTRIBUTING.
This project is under the MIT License; cf. LICENSE for details.