synchronizer
1.0.0
這個庫可以輕鬆同步各種事物。它具有美觀且易於使用的 API。
synchronizer是作為我們的部署和測試工具 Seabreeze 的後端而開發的。
synchronizer庫只是一個抽象的基礎。但具體的實現是可以的:
包含供應商自動載入器並使用以下類別:
namespace Acme MyApplication ;
// To create a synchronizer :
use FlameCore synchronizer Abstract synchronizer ;
use FlameCore synchronizer synchronizer SourceInterface ;
use FlameCore synchronizer synchronizer TargetInterface ;
// To make your project compatible with synchronizer :
use FlameCore synchronizer synchronizer Interface ;
require ' vendor/autoload.php ' ;
創建你的synchronizer :
class Example synchronizer extends Abstract synchronizer
{
/**
* @param bool $preserve Preserve obsolete objects
* @return bool Returns whether the synchronization succeeded.
*/
public function synchronize ( $ preserve = true )
{
// Do the sync magic
return true ;
}
/**
* @param synchronizer SourceInterface $source The source
* @return bool Returns whether the synchronizer supports the source.
*/
public function supportsSource ( synchronizer SourceInterface $ source )
{
return $ source instanceof ExampleSource;
}
/**
* @param synchronizer TargetInterface $target The target
* @return bool Returns whether the synchronizer supports the target.
*/
public function supportsTarget ( synchronizer TargetInterface $ target )
{
return $ target instanceof ExampleTarget;
}
}
建立您的來源和目標:
class ExampleSource implements synchronizer SourceInterface
{
/**
* @param array $settings The settings
*/
public function __construct ( array $ settings )
{
// Save settings
}
// Your methods...
}
class ExampleTarget implements synchronizer TargetInterface
{
/**
* @param array $settings The settings
*/
public function __construct ( array $ settings )
{
// Save settings
}
// Your methods...
}
讓您的專案與synchronizer相容:
class Application
{
protected $ synchronizer ;
public function set synchronizer ( synchronizer Interface $ synchronizer )
{
$ this -> synchronizer = $ synchronizer ;
}
// ...
}
如果您的系統上尚未安裝 Composer,請安裝它:
$ curl -sS https://getcomposer.org/installer | php
要安裝該庫,請執行以下命令,您將獲得最新版本:
$ php composer.phar require flamecore/ synchronizer
如果您想貢獻,請先查看貢獻文件。