<?php

/**
 * Gompertz
 */
class Gompertz
{
    /**
     * data
     *
     * @var array
     * @access public
     */
    public $data;

    public $service;

    public $path;

    public $b;

    public $a;

    public $k;

    /**
     * 构造方法。
     *
     * The construct function.
     *
     * @access public
     * @return void
     */
    public function __construct($data)
    {
        global $config;
        $this->service = $config->gonumService;
        $this->path    = __DIR__;
        $this->data = $data;

        $dataStr = implode(' ', $data);
        $path = $this->path;
        $result = exec("$path/{$this->service} -exec -method=gompertz $dataStr");

        list($b, $a, $K) = explode(' ', $result);

        $this->b = (float)$b;
        $this->a = (float)$a;
        $this->K = (float)$K;
    }
}
