/** * @expectedException Khill\Lavacharts\Exceptions\ChartNotFound */ public function testGetNonExistantLabelChart() { $v = new Volcano(); $c = new LineChart('testchart'); $v->storeChart($c); $v->getChart('LineChart', 'superduperchart'); }
/** * Creates and stores Dashboards * * If the Dashboard is found in the Volcano, then it is returned. * Otherwise, a new dashboard is created and stored in the Volcano. * * @access private * @since 3.0.0 * @uses \Khill\Lavacharts\Dashboards\Dashboard * @param \Khill\Lavacharts\Values\Label $label Label of the dashboard. * @return \Khill\Lavacharts\Dashboards\Dashboard */ private function dashboardFactory(Label $label) { if ($this->volcano->checkDashboard($label) === false) { $dashboard = new Dashboard($label); $this->volcano->storeDashboard($dashboard); } return $this->volcano->getDashboard($label); }
/** * Creates and stores Dashboards * * If the Dashboard is found in the Volcano, then it is returned. * Otherwise, a new chart is created and stored in the Volcano. * * @access private * @since v2.0.0 * * @uses Dashboard * @param string $type Type of chart to fetch or create. * @param string $label Label of the chart. * * @return Chart */ private function dashboardFactory($type, $label) { $chartObject = __NAMESPACE__ . '\\Controls\\' . $type; if (!$this->volcano->checkDashboard($type, $label)) { $chart = new $chartObject($label); $this->volcano->storeDashboard($chart); } return $this->volcano->getDashboard($type, $label); }
/** * Creates and stores Charts * * If the Chart is found in the Volcano, then it is returned. * Otherwise, a new chart is created and stored in the Volcano. * * @access private * @since v2.0.0 * * @uses Chart * @param string $type Type of chart to fetch or create. * @param string $label Label of the chart. * * @return Chart */ private function chartFactory($type, $label) { $chartObject = __NAMESPACE__ . '\\Charts\\' . $type; if (!$this->volcano->checkChart($type, $label)) { $chart = new $chartObject($label); $this->volcano->storeChart($chart); } return $this->volcano->getChart($type, $label); }
/** * Helper function to "create" for type hinting. * * @param string $type Type of chart to create. * @param \Khill\Lavacharts\DataTables\DataTable $datatable DataTable for the chart. * @param \Khill\Lavacharts\Values\Label $label Chart label. * @param \Khill\Lavacharts\Configs\Options $options Chart options. * @throws \Khill\Lavacharts\Exceptions\InvalidLabel * @throws \Khill\Lavacharts\Exceptions\InvalidLavaObject * @return \Khill\Lavacharts\Charts\Chart */ private function createChart($type, DataTable $datatable, Label $label, Options $options) { if ($this->volcano->checkChart($type, $label) === true) { return $this->volcano->getChart($type, $label); } $newChart = __NAMESPACE__ . '\\' . $type; $chart = new $newChart($label, $datatable, $options); $this->volcano->storeChart($chart); return $chart; }