synchronizer
1.0.0
Perpustakaan ini memudahkan untuk menyinkronkan segala macam hal. Ini menampilkan API yang indah dan mudah digunakan.
synchronizer dikembangkan sebagai backend untuk penerapan dan alat pengujian kami, Seabreeze.
Pustaka synchronizer hanyalah fondasi abstrak. Namun ada implementasi nyata yang tersedia:
Sertakan autoloader vendor dan gunakan kelas:
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 ' ;Buat synchronizer Anda:
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;
}
}Buat Sumber dan Target Anda:
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...
}Jadikan proyek Anda kompatibel dengan synchronizer :
class Application
{
protected $ synchronizer ;
public function set synchronizer ( synchronizer Interface $ synchronizer )
{
$ this -> synchronizer = $ synchronizer ;
}
// ...
}Instal Komposer jika Anda belum memilikinya di sistem Anda:
$ curl -sS https://getcomposer.org/installer | php
Untuk menginstal perpustakaan, jalankan perintah berikut dan Anda akan mendapatkan versi terbaru:
$ php composer.phar require flamecore/ synchronizer
Jika ingin berkontribusi silahkan lihat file CONTRIBUTING terlebih dahulu.