/** * Dodaj zasób * * @param ResourceInterface $res * @param string|null $group */ public function add(ResourceInterface $res, $group = null) { parent::add($res, $group); // zaktualizuje listę plików do scalenia if ($res->getCombineObject()) { foreach ($res->getSources() as $source) { $res->getCombineObject()->addSource($source); } } $name = $res->getName(); // jeśli zasób nie ma nazwy if (empty($name)) { $res->setName((string) $group); } else { $res->setName((string) $group . '_' . $name); } // jeśli nazwa jest zajęta ustaw strategię na auto if (isset($this->registerNames[$res->getName()])) { if ($res->getCombineObject()) { $res->getCombineObject()->setOutputStrategy('auto'); } } else { // zarejestruj nawę $this->registerNames[$res->getName()] = true; } }
/** * Dodaj zasób * * @param ResourceInterface $res * @param string $group * * @throws \UnexpectedValueException */ public function add(ResourceInterface $res, $group = null) { if (!$res instanceof ImageResource) { throw new \UnexpectedValueException('Resource is not image'); } parent::add($res, $group); }