Example #1
0
 public static function getInstance()
 {
     if (null === self::$_instance) {
         $stamp = new self();
         $stamp->_licenseNum = '02651';
         $stamp->_licenseDate = '08.08.2011 0:00:00';
         $stamp->_name = 'ООО "НЖТ-ВОСТОК"';
         $stamp->_ogrnNum = '1107746402246';
         $stamp->_ogrnDate = '17.05.2010 0:00:00';
         $stamp->_brand = 'FORD';
         $stamp->_model = 'FOCUS';
         $stamp->_regNum = 'ЕМ33377';
         $stamp->_year = '2011';
         $stamp->_blankNum = '002695';
         $stamp->_info = '';
         self::$_instance = $stamp;
     }
     return self::$_instance;
 }
Example #2
0
require_once 'helpers.inc.php';
spl_autoload_register(function ($className) {
    require_once "classes/{$className}" . '.php';
});
$conn = dbConnect();
$sql = 'INSERT INTO requests (id, startdate, enddate, request_time, result, body, header) VALUES (NULL,?,?,?,?,?,?)';
try {
    $client = new SoapClient('http://82.138.16.126:8888/TaxiPublic/Service.svc?wsdl', array("trace" => 1));
    $start = date('Y-m-d H:i:s');
    $startmicro = microtime(true);
    $result = $client->GetTaxiInfos(array('request' => array('RegNum' => 'лЋлю33377')));
    $endmicro = microtime(true);
    $end = date('Y-m-d H:i:s');
    $time = $endmicro - $startmicro;
    $response = $client->__getLastResponse();
    $response_head = $client->__getLastResponseHeaders();
    $arr = parseXmlResponse($response);
    $compare_result = Taxi::compareWithPattern($arr[0]);
    $stmt = $conn->prepare($sql);
    if ($compare_result) {
        $stmt->execute(array($start, $end, $time, 1, NULL, NULL));
    } else {
        $stmt->execute(array($start, $end, $time, 0, $response, $response_head));
    }
    if ($stmt->rowCount()) {
        echo 'SQL INSERT SUCCESS';
        echo '<br/>';
    }
} catch (SoapFault $fault) {
    trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
Example #3
0
class Car
{
    public function __construct()
    {
        echo '12334';
    }
    public static function model()
    {
        static::getModel();
    }
    protected static function getModel()
    {
        echo "This is a car model" . PHP_EOL;
    }
}
Car::model();
class Taxi extends Car
{
    public function __construct()
    {
        parent::__construct();
        echo '12334';
    }
    protected static function getModel()
    {
        echo "This is a Taxi model2" . PHP_EOL;
    }
}
Taxi::model();
Example #4
0
 /**
  * @param Taxi $taxi
  * @param float $amount
  */
 public function payForTaxi(Taxi $taxi, $amount)
 {
     $taxi->addMoney($amount);
     $this->spendMoney($amount);
 }
Example #5
0
class Taxi extends Car
{
    const STARTING_FARE = 730;
    private $fare = self::STARTING_FARE;
    public static $numberOfTaxis = 0;
    public function __construct($gasoline)
    {
        $this->gasoline = $gasoline;
        self::$numberOfTaxis++;
    }
    public static function countTaxis()
    {
        echo 'タクシーの生産台数は' . self::$numberOfTaxis . '台です<br>';
    }
    public function go()
    {
        parent::go();
        $this->fare += 90;
    }
    public function checkout()
    {
        echo 'お会計は' . $this->fare . '円です<br>';
        $this->fare = self::STARTING_FARE;
    }
}
// echo Taxi::$numberOfTaxis;
$myTaxi1 = new Taxi(50);
$myTaxi2 = new Taxi(50);
$myTaxi3 = new Taxi(50);
Taxi::countTaxis();
Example #6
0
//header('Content-Type: text/xml');
try {
    $client = new SoapClient('http://82.138.16.126:8888/TaxiPublic/Service.svc?wsdl', array("trace" => 1));
    var_dump($client->__getFunctions());
    echo '<pre>';
    echo '<h2>Types:</h2>';
    $types = $client->__getTypes();
    foreach ($types as $type) {
        $type = preg_replace(array('/(\\w+) ([a-zA-Z0-9]+)/', '/\\n /'), array('<font color="green">${1}</font> <font color="blue">${2}</font>', "\n\t"), $type);
        echo $type;
        echo "\n\n";
    }
    echo '</pre>';
    $result = $client->GetTaxiInfos(array('request' => array('RegNum' => 'лЋлю33377')));
    print_r($result);
    print_r(Taxi::constructFromResponse($result));
    //$result = $client->GetTaxiInfos();
    echo '<h2>Response</h2>';
    echo '<pre>';
    $response = $client->__getLastResponse();
    $correct_xml_from_response = '<?xml version="1.0" encoding="UTF-8"?>' . $response;
    $response_head = $client->__getLastResponseHeaders();
    var_dump($response);
    $res = simplexml_load_string($correct_xml_from_response);
    foreach ($res->children('s', true) as $x) {
        $children = $x->children();
        //body
        foreach ($children as $child) {
            //GetTaxiInfosResponse
            foreach ($child->children() as $x) {
                //taxi info