/** * I build filter functions based on $this->_Swagger->collectionFormat */ protected function _buildFilters() { // if (!isset($this->_Swagger->collectionFormat)) { // throw new \Exception('missing property: collectionFormat'); // } parent::_buildFilters(); $collectionFormat = isset($this->_data->collectionFormat) ? $this->_data->collectionFormat : 'csv'; // first filter will cut $value to array if necessary $this->_filters[] = function ($value) use($collectionFormat) { if (is_null($value)) { } elseif (is_array($value)) { if ($collectionFormat == 'multi') { throw new \Exception('TBI: MULTI'); } } elseif (is_string($value)) { switch ($collectionFormat) { case 'ssv': $value = explode(' ', $value); break; case 'tsv': $value = explode('\\', $value); break; case 'pipes': $value = explode('|', $value); break; case 'csv': default: $value = explode(',', $value); // break; } } else { throw new \Exception('could not apply collectionFormat: ' . $collectionFormat); } return $value; }; // I'll run each value through the pseudo-param entity's filter by setting the value and getting it back $ItemParameterSample = $this->ParameterFactory->buildParameter($this->_data->items); $this->_filters[] = function ($value) use($ItemParameterSample) { if (is_array($value)) { foreach ($value as &$eachValue) { $ItemParameterSample->setValue($eachValue); $eachValue = $ItemParameterSample->getValue(); } } return $value; }; }
protected function _buildFilters() { parent::_buildFilters(); $this->_filters[] = 'realFloat'; }
protected function _buildFilters() { ParameterAbstract::_buildFilters(); $this->_filters[] = 'realInt'; }