count($this->data) replace to empty($this->data)