Skip to content

Commit

Permalink
Merge pull request #12 from ccoley/10-countable-warning
Browse files Browse the repository at this point in the history
Fix warnings when using count() on non-countable types. Fixes #10
  • Loading branch information
ccoley authored Dec 31, 2018
2 parents 916d5d1 + 0e2f361 commit 16ace32
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/zc.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function setScaleYLabels($yAxisRange) { // "0:100:5"
}
public function setSeriesData() {
$numArgs = func_num_args();
if ($numArgs == 1) {
if ($numArgs == 1 && is_array(func_get_arg(0))) {
for ($j = 0; $j < count(func_get_arg(0)); $j++) {
$this->setConfig('series['.$j.'].values', func_get_arg(0)[$j]);
}
Expand All @@ -203,7 +203,7 @@ public function setSeriesData() {
}
public function setSeriesText() {
$numArgs = func_num_args();
if ($numArgs == 1) {
if ($numArgs == 1 && is_array(func_get_arg(0))) {
for($i = 0; $i < count(func_get_arg(0)); $i++) {
$this->setConfig('series['.$i.'].text', func_get_arg(0)[$i]);
//$this->config['series'][$i]['text'] = func_get_arg(0)[$i];
Expand Down Expand Up @@ -344,7 +344,7 @@ public function setConfig($keyChain, $val) {
if ($indexStart > -1) {
$index = (int) substr($chain[0], $indexStart+1, ($indexEnd-$indexStart)-1);
$parentKey = substr($chain[0], 0, $indexStart);
if (count($chain[1])) {
if (strlen($chain[1])) {
$this->config[$parentKey][$index][$chain[1]] = $val;
}
}
Expand Down

0 comments on commit 16ace32

Please sign in to comment.