public function __construct($argc, $argv)
 {
     try {
         $this->mysqli = Db\Connection::createMysqli();
     } catch (\Exception $e) {
         die("Please config this application for your system. " . $e->getMessage() . "\n");
     }
     try {
         if ($argc == 5 && $argv[1] == 'add' && $argv[2] == 'warehouse') {
             $this->addWarehouse($argv[3], $argv[4]);
         } else {
             if ($argc == 6 && $argv[1] == 'add' && $argv[2] == 'product') {
                 $this->addProduct($argv[3], $argv[4], $argv[5]);
             } else {
                 if ($argc == 6 && $argv[1] == 'add' && $argv[2] == 'inventory' && $argv[5] > 0) {
                     $this->addInventory($argv[3], $argv[4], $argv[5]);
                 } else {
                     if ($argc == 3 && $argv[1] == 'order') {
                         $this->order($argv[2]);
                     } else {
                         $this->help();
                     }
                 }
             }
         }
     } catch (\Exception $e) {
         die("Error: " . $e->getMessage() . "\n");
     }
 }
示例#2
0
<?php

namespace Portfolio;

require_once dirname(__DIR__) . '/bootstrap.php';
$uri = $_SERVER['REQUEST_URI'];
if (strpos($uri, '?') !== false) {
    $uri = substr($uri, 0, strpos($uri, '?'));
}
$request = array_values(array_filter(explode('/', $uri)));
$db = Db\Connection::createMysqli();
if (!$request) {
    new Reports\Home($db);
} else {
    if (count($request) >= 3 && $request[0] == 'data' && $request[1] == 'annual') {
        new Data\Annual($db, $request[2], array_slice($request, 3));
    } else {
        if (count($request) >= 3 && $request[0] == 'data' && $request[1] == 'investments') {
            new Data\Investments($db, $request[2], array_slice($request, 3));
        } else {
            if (count($request) >= 3 && $request[0] == 'data' && $request[1] == 'growthsummary') {
                new Data\GrowthSummary($db, $request[2], array_slice($request, 3));
            } else {
                if (count($request) >= 3 && $request[0] == 'data' && $request[1] == 'categories') {
                    new Data\Categories($db, $request[2], array_slice($request, 3));
                } else {
                    if (count($request) >= 3 && $request[0] == 'data' && $request[1] == 'allocations') {
                        new Data\Allocations($db, $request[2], array_slice($request, 3));
                    } else {
                        if (count($request) == 1 && $request[0] == 'phpinfo') {
                            phpinfo();