Example #1
0
 public function __construct($dir)
 {
     $this->fileLoader = new jsonFileLoader();
     $this->fileLoader->setRouteCollection(new RouteCollection());
     $this->fileLoader->setRouteClass(new Route());
     $this->router = new Router();
     $this->router->setRouteCollection($this->fileLoader->load($dir . '/routes.json'));
     $this->registry = Registry::getInstance();
 }
Example #2
0
 public function __construct($url, $file)
 {
     $this->url = $url;
     $this->fileName = $file;
     $this->registry = Registry::getInstance();
     $this->config = $this->registry->config;
     $this->set = new \Net_Gearman_Set();
     $this->gearmanManager = new \Net_Gearman_Manager($this->config->getSystemConfig()->getGearmanHost());
     $this->client = new \Net_Gearman_Client($this->registry->config->getSystemConfig()->getGearmanHost(), 1);
 }
Example #3
0
 public function run($arg)
 {
     $registry = \sys\Registry::getInstance();
     $command = $registry->application->find('parse');
     $arguments = array('command' => 'parse ', 'urls' => $arg['arg']['url'], 'file' => $arg['arg']['file']);
     //exec('php index.php parse '.$arg['arg']['url'],$output,$returnCode);
     $greetInput = new \Symfony\Component\Console\Input\ArrayInput($arguments);
     $output = new Symfony\Component\Console\Output\ConsoleOutput();
     $returnCode = $command->run($greetInput, $output);
     foreach ($output as $otpt) {
         echo $otpt . PHP_EOL;
     }
     echo 'return code=' . $returnCode . PHP_EOL . PHP_EOL . PHP_EOL . PHP_EOL;
     unset($command);
     return array('returnCode' => $returnCode, 'arg' => $arg);
 }
Example #4
0
 static function readFile($file)
 {
     $config = Registry::getInstance()->config->getSystemConfig();
     $dataNew = array();
     $heading = array();
     foreach (file($file) as $key) {
         if (empty($heading)) {
             $heading = str_getcsv($key, $config->getCsvSeparator());
         } else {
             $product = str_getcsv($key, $config->getCsvSeparator());
             foreach ($heading as $key => $value) {
                 $dataNew[$product[0]][$value] = str_getcsv($product[$key]);
             }
         }
     }
     return $dataNew;
 }
Example #5
0
 public function __construct()
 {
     $this->registry = Registry::getInstance();
     $this->config = Registry::getInstance()->config->getSystemConfig();
 }
Example #6
0
 public function __construct()
 {
     parent::__construct();
     $this->registry = Registry::getInstance();
 }
Example #7
0
require __DIR__ . '/vendor/autoload.php';
use Commands\Compare;
use Commands\Worker;
use Symfony\Component\Console\Application;
use Commands\Parse;
use Symfony\Component\EventDispatcher\EventDispatcher;
use sys\Config\Config;
use sys\Logger\FileLogger;
use sys\Logger\Logger;
use sys\Registry;
use sys\Router\Route;
use sys\Router\RouteCollection;
use sys\Router\Router;
use sys\Router\Loader\jsonFileLoader as RouterLoader;
use sys\Config\Loader\jsonFileLoader as ConfigLoader;
$registry = Registry::getInstance();
$configLoader = new ConfigLoader();
$configLoader->setConfigObject(new Config());
$registry->config = $configLoader->load('config/config.json');
$registry->router = new Router();
$registry->eventDispatcher = new EventDispatcher();
$routeLoader = new RouterLoader();
$routeLoader->setRouteCollection(new RouteCollection());
$routeLoader->setRouteClass(new Route());
$registry->router->setRouteCollection($routeLoader->load("config/routes.json"));
try {
    $application = new Application();
    $registry->application = $application;
    $application->add(new Parse());
    $application->add(new Worker());
    $application->add(new Compare());