/** * parse autocompleted brands. * * @param \stdClass $jsonObject * @param ModelFactoryInterface $factory * * @return Brand[] */ protected static function parseBrands(\stdClass $jsonObject, ModelFactoryInterface $factory) { if (!property_exists($jsonObject, 'brands')) { return self::NOT_REQUESTED; } if ($jsonObject->brands === null) { return array(); } $brands = array(); foreach ($jsonObject->brands as $brand) { $brands[] = $factory->createBrand($brand); } return $brands; }