factory() public static method

Create a server storage instance
public static factory ( string $type, string $dsn ) : dropr_Server_Storage_Abstract
$type string
$dsn string
return dropr_Server_Storage_Abstract
Beispiel #1
0
#!/usr/bin/php
<?php 
$_STORAGE = $argv[1];
$_DSN = $argv[2];
if ('' == $_STORAGE) {
    die("\nERROR: Missing storage type!\n\n");
}
if ('' == $_DSN) {
    die("\nERROR: Missing DSN!\n\n");
}
$_COMMAND = $argv[3];
$_PARAM1 = $argv[4];
$_PARAM2 = $argv[5];
require realpath(dirname(__FILE__) . "/../..") . "/classes/dropr.php";
$storage = dropr_Server_Storage_Abstract::factory($_STORAGE, $_DSN);
switch ($_COMMAND) {
    case "get_channels":
        echo "\n";
        foreach ($storage->getQueuedChannels() as $channel) {
            echo $channel . "\n";
        }
        echo "\n";
        break;
    case "count_queued":
        if ('' == $_PARAM1) {
            die("\nERROR: Missing channel name!\n\n");
        }
        echo $storage->countQueuedMessages($_PARAM1) . "\n";
        break;
    case "list_queued":
        foreach ($storage->getQueuedChannels() as $channel) {
 public function setUp()
 {
     $this->dir = dirname(__FILE__) . '/testspool/server';
     $this->storage = dropr_Server_Storage_Abstract::factory('Filesystem', $this->dir);
 }