-
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
750 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
$imiPath = dirname(__DIR__) . '/'; | ||
$pharFile = $imiPath . 'imi.phar'; | ||
|
||
class FileRegexIterator implements Iterator | ||
{ | ||
private $iterator; | ||
|
||
public function __construct(Iterator $iterator) | ||
{ | ||
$this->iterator = $iterator; | ||
} | ||
|
||
public function current () | ||
{ | ||
return $this->iterator->current(); | ||
} | ||
|
||
public function key () | ||
{ | ||
return $this->iterator->key(); | ||
} | ||
|
||
public function next () | ||
{ | ||
do{ | ||
$this->iterator->next(); | ||
$current = $this->iterator->current(); | ||
if(false === $current) | ||
{ | ||
return false; | ||
} | ||
}while($this->isDot($current)); | ||
} | ||
|
||
public function rewind () | ||
{ | ||
$this->iterator->rewind(); | ||
if($this->isDot($this->iterator->current())) | ||
{ | ||
$this->next(); | ||
} | ||
} | ||
|
||
public function valid () | ||
{ | ||
return $this->iterator->valid(); | ||
} | ||
|
||
private function isDot($fileName) | ||
{ | ||
$basename = basename($fileName); | ||
return '.' === $basename || '..' === $basename; | ||
} | ||
} | ||
|
||
if(is_file($pharFile)) | ||
{ | ||
echo 'deleting file: ', $pharFile, PHP_EOL; | ||
unlink($pharFile); | ||
} | ||
|
||
$phar = new Phar($pharFile); | ||
$phar->stopBuffering(); | ||
echo 'building from directory: ', $imiPath, PHP_EOL; | ||
|
||
$directory = new \RecursiveDirectoryIterator($imiPath); | ||
$iterator = new \RecursiveIteratorIterator($directory); | ||
$regex = new \RegexIterator($iterator, '/^((?!(\/.git\/)).)*$/'); | ||
$fileIterator = new FileRegexIterator($regex); | ||
|
||
$phar->buildFromIterator($fileIterator, $imiPath); | ||
|
||
$phar->setStub($phar->createDefaultStub('src/PharMain.php')); | ||
|
||
echo 'build OK!', PHP_EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
namespace Imi\Model\Event\Listener; | ||
|
||
use Imi\Model\Event\Param\AfterFindEventParam; | ||
|
||
/** | ||
* 模型 查找后 事件监听接口 | ||
*/ | ||
interface IAfterFindEventListener | ||
{ | ||
/** | ||
* 事件处理方法 | ||
* @param AfterFindEventParam $e | ||
* @return void | ||
*/ | ||
public function handle(AfterFindEventParam $e); | ||
} |
Oops, something went wrong.