/** * {@inheritDoc} */ public function getSession() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getSession', array()); return parent::getSession(); }
private function listLazaretFile(LazaretFile $file) { $manager = $this->getBorderManager(); /** @var TranslatorInterface $translator */ $translator = $this->app['translator']; $checks = array_map(function (LazaretCheck $checker) use($manager, $translator) { $checkerFQCN = $checker->getCheckClassname(); return $manager->getCheckerFromFQCN($checkerFQCN)->getMessage($translator); }, iterator_to_array($file->getChecks())); $usr_id = $user = null; if ($file->getSession()->getUser()) { $user = $file->getSession()->getUser(); $usr_id = $user->getId(); } $session = ['id' => $file->getSession()->getId(), 'usr_id' => $usr_id, 'user' => $user ? $this->listUser($user) : null]; return ['id' => $file->getId(), 'quarantine_session' => $session, 'base_id' => $file->getBaseId(), 'original_name' => $file->getOriginalName(), 'sha256' => $file->getSha256(), 'uuid' => $file->getUuid(), 'forced' => $file->getForced(), 'checks' => $file->getForced() ? [] : $checks, 'created_on' => $file->getCreated()->format(DATE_ATOM), 'updated_on' => $file->getUpdated()->format(DATE_ATOM)]; }
private function list_lazaret_file(Application $app, LazaretFile $file) { $checks = array_map(function ($checker) use($app) { return $checker->getMessage($app['translator']); }, iterator_to_array($file->getChecks())); $usr_id = $user = null; if ($file->getSession()->getUser()) { $user = $file->getSession()->getUser(); $usr_id = $user->getId(); } $session = ['id' => $file->getSession()->getId(), 'usr_id' => $usr_id, 'user' => $user ? $this->list_user($user) : null]; return ['id' => $file->getId(), 'quarantine_session' => $session, 'base_id' => $file->getBaseId(), 'original_name' => $file->getOriginalName(), 'sha256' => $file->getSha256(), 'uuid' => $file->getUuid(), 'forced' => $file->getForced(), 'checks' => $file->getForced() ? [] : $checks, 'created_on' => $file->getCreated()->format(DATE_ATOM), 'updated_on' => $file->getUpdated()->format(DATE_ATOM)]; }
protected function list_lazaret_file(LazaretFile $file) { $checks = []; if ($file->getChecks()) { foreach ($file->getChecks() as $checker) { $checks[] = $checker->getMessage($this->app['translator']); } } $usr_id = null; if ($file->getSession()->getUser()) { $usr_id = $file->getSession()->getUser()->getId(); } $session = ['id' => $file->getSession()->getId(), 'usr_id' => $usr_id]; return ['id' => $file->getId(), 'quarantine_session' => $session, 'base_id' => $file->getBaseId(), 'original_name' => $file->getOriginalName(), 'sha256' => $file->getSha256(), 'uuid' => $file->getUuid(), 'forced' => $file->getForced(), 'checks' => $file->getForced() ? [] : $checks, 'created_on' => $file->getCreated()->format(DATE_ATOM), 'updated_on' => $file->getUpdated()->format(DATE_ATOM)]; }