4 * This file is part of the Behat
6 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
8 * This source file is subject to the MIT license that is bundled
9 * with this source code in the file LICENSE.
12 $filename = 'mink_extension.phar';
14 if (file_exists($filename)) {
18 $phar = new \Phar($filename, 0, 'extension.phar');
19 $phar->setSignatureAlgorithm(\Phar::SHA1);
20 $phar->startBuffering();
22 foreach (findFiles('src') as $path) {
23 $phar->addFromString($path, file_get_contents(__DIR__.'/'.$path));
26 $phar->addFromString('init.php', file_get_contents(__DIR__.'/init.php'));
28 $phar->setStub(<<<STUB
32 * This file is part of the Behat
34 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
36 * This source file is subject to the MIT license that is bundled
37 * with this source code in the file LICENSE.
40 Phar::mapPhar('extension.phar');
42 return require 'phar://extension.phar/init.php';
47 $phar->stopBuffering();
49 function findFiles($dir) {
50 $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir),
51 RecursiveIteratorIterator::CHILD_FIRST);
54 foreach ($iterator as $path) {
55 if ($path->isFile()) {
56 $files[] = $path->getPath().DIRECTORY_SEPARATOR.$path->getFilename();