Ejemplo n.º 1
3
function get_news()
{
    global $NEWS;
    foreach ($NEWS as $i) {
        #var_dump($i);
        $class = $i['isImportant'] ? 'important' : '';
        $now = new DateTimeImmutable('now');
        $date = new DateTimeImmutable($i['date']);
        $d_start = array_key_exists('dateOn', $i) ? new DateTime($i['dateOn']) : $now;
        $d_end = array_key_exists('dateOff', $i) ? new DateTime($i['dateOff']) : $date->add(new DateInterval('P14D'));
        #var_dump($date);
        #var_dump($d_start);
        #var_dump($d_end);
        if ($now < $d_start or $now > $d_end) {
            continue;
        }
        echo <<<HTML

<li class="{$class}">
    <div class="newsitem">
        <strong>{$i['title']}</strong>
        <br />

{$i['text']}

    </div>
</li>

HTML;
    }
}
 public function authenticate(array $credentials)
 {
     $mcrypt = mcrypt_module_open(MCRYPT_BLOWFISH, '', MCRYPT_MODE_CBC, '');
     $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($mcrypt), MCRYPT_DEV_RANDOM);
     mcrypt_generic_init($mcrypt, $this->cryptPassword, $iv);
     $url = $this->getUrl($credentials[self::USERNAME], $credentials[self::PASSWORD], $mcrypt, $iv);
     try {
         $res = $this->httpClient->get($url)->send();
     } catch (\Guzzle\Http\Exception\ClientErrorResponseException $e) {
         if ($e->getResponse()->getStatusCode() === 403) {
             throw new \Nette\Security\AuthenticationException("User '{$credentials[self::USERNAME]}' not found.", self::INVALID_CREDENTIAL);
         } elseif ($e->getResponse()->getStatusCode() === 404) {
             throw new \Nette\Security\AuthenticationException("Invalid password.", self::IDENTITY_NOT_FOUND);
         } else {
             throw $e;
         }
     }
     $responseBody = trim(mdecrypt_generic($mcrypt, $res->getBody(TRUE)));
     $apiData = Json::decode($responseBody);
     $user = $this->db->table('users')->where('id = ?', $apiData->id)->fetch();
     $registered = new \DateTimeImmutable($apiData->registered->date, new \DateTimeZone($apiData->registered->timezone));
     $userData = array('username' => $credentials[self::USERNAME], 'password' => $this->calculateAddonsPortalPasswordHash($credentials[self::PASSWORD]), 'email' => $apiData->email, 'realname' => $apiData->realname, 'url' => $apiData->url, 'signature' => $apiData->signature, 'language' => $apiData->language, 'num_posts' => $apiData->num_posts, 'apiToken' => $apiData->apiToken, 'registered' => $registered->getTimestamp());
     if (!$user) {
         $userData['id'] = $apiData->id;
         $userData['group_id'] = 4;
         $this->db->table('users')->insert($userData);
         $user = $this->db->table('users')->where('username = ?', $credentials[self::USERNAME])->fetch();
     } else {
         $user->update($userData);
     }
     return $this->createIdentity($user);
 }
Ejemplo n.º 3
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeln('Starting...');
     $output->writeln('Getting disrupted lines...');
     $lines = $this->getContainer()->get('console.services.line')->findAllDisrupted();
     $count = $lines->getResultCount();
     $output->writeln($count . ' disrupted lines');
     $now = new \DateTimeImmutable();
     if ($count > 0) {
         $lines = $lines->getDomainModels();
         $day = (int) $now->format('N');
         $hour = (int) $now->format('H');
         foreach ($lines as $line) {
             $output->writeln('Getting relevant subscriptions for ' . $line->getName() . ' on day ' . $day . ', hour ' . $hour . '...');
             $subscriptions = $this->getContainer()->get('console.services.subscription')->findAllForLineAndHour($line, $day, $hour);
             $scount = $subscriptions->getResultCount();
             $output->writeln($scount . ' subscriptions found');
             if ($scount > 0) {
                 $title = $line->getStatusSummary();
                 $this->notify($line, $title, $subscriptions->getDomainModels());
                 $output->writeln('Notified ' . $line->getName() . ': ' . $title);
                 // if we sent out some notifications, sleep for 2 seconds before sending more
                 sleep(2);
             }
         }
     }
     $output->writeln('Done');
 }
 public function render($dados)
 {
     $this->Cell(array_sum($this->columnsWidth), 9, utf8_decode('Total de Registros: ' . count($dados)), 1, 0, 'L', 0);
     $this->Ln();
     $this->tableHeader();
     $this->SetFont('Arial', '', 8);
     $this->SetFillColor(224, 235, 255);
     $x = 0;
     foreach ($dados as $tratamento) {
         $inclusao = \DateTime::createFromFormat('Y-m-d', $tratamento->tto_data_inicio);
         $hoje = new \DateTimeImmutable();
         $nascimento = \DateTime::createFromFormat('Y-m-d', $tratamento->pac_nascimento);
         $idade = $hoje->diff($nascimento);
         $duracao = $hoje->diff($inclusao);
         $arTr = explode(' ', $tratamento->prof_nome);
         $fill = $x % 2 === 0;
         $this->SetLineWidth('.3');
         $this->Cell($this->columnsWidth[0], $this->lineHeight, $x + 1, 1, 0, 'L', $fill);
         $this->Cell($this->columnsWidth[1], $this->lineHeight, utf8_decode($tratamento->pac_nome), 1, 0, 'L', $fill);
         $this->Cell($this->columnsWidth[2], $this->lineHeight, utf8_decode($tratamento->pac_cns), 1, 0, 'L', $fill);
         $this->Cell($this->columnsWidth[3], $this->lineHeight, $tratamento->tto_diagnostico, 1, 0, 'L', $fill);
         $this->Cell($this->columnsWidth[4], $this->lineHeight, $tratamento->pac_sexo, 1, 0, 'L', $fill);
         $this->Cell($this->columnsWidth[5], $this->lineHeight, $inclusao->format('d-m-Y'), 1, 0, 'L', $fill);
         $this->Cell($this->columnsWidth[6], $this->lineHeight, utf8_decode($tratamento->tto_turno), 1, 0, 'L', $fill);
         $this->Cell($this->columnsWidth[7], $this->lineHeight, utf8_decode($arTr[0]), 1, 0, 'L', $fill);
         $this->Cell($this->columnsWidth[8], $this->lineHeight, utf8_decode($duracao->format('%a dias')), 1, 0, 'L', $fill);
         $this->Cell($this->columnsWidth[9], $this->lineHeight, utf8_decode($idade->format('%Y Anos')), 1, 0, 'L', $fill);
         $this->Cell($this->columnsWidth[10], $this->lineHeight, utf8_decode(html_entity_decode($tratamento->ubs_nome)), 1, 0, 'L', $fill);
         $this->Ln();
         $x++;
     }
     $this->Cell(array_sum($this->columnsWidth), 0, '', 'T');
 }
Ejemplo n.º 5
0
 /**
  * @param  \stdClass $obj
  * @param  array     $context
  * @return \Twitter\Object\Tweet
  */
 public function unserialize($obj, array $context = [])
 {
     Assertion::true($this->canUnserialize($obj), 'object is not unserializable');
     $createdAt = new \DateTimeImmutable($obj->created_at);
     Assertion::eq(new \DateTimeZone('UTC'), $createdAt->getTimezone());
     return Tweet::create(TwitterMessageId::create($obj->id), $this->userSerializer->unserialize($obj->user), $obj->text, $obj->lang, $createdAt, $obj->entities ? $this->twitterEntitiesSerializer->unserialize($obj->entities) : TwitterEntities::create(), $obj->coordinates ? $this->coordinatesSerializer->unserialize($obj->coordinates) : null, $obj->place ? $this->placeSerializer->unserialize($obj->place) : null, $obj->in_reply_to_status_id, $obj->in_reply_to_user_id, $obj->in_reply_to_screen_name, $obj->retweeted, $obj->retweet_count, $obj->favorited, $obj->favorite_count, $obj->truncated, $obj->source, isset($obj->retweeted_status) ? $this->unserialize($obj->retweeted_status) : null);
 }
Ejemplo n.º 6
0
 /**
  * Set first and last days of accounting year
  *
  * @param  \DateTimeImmutable $firstDay First day of accounting year
  * @param  \DateTimeImmutable $lastDay  Last day of accounting year
  * @return self Instance to enable chaining
  */
 public function setAccountingYear(\DateTimeImmutable $firstDay, \DateTimeImmutable $lastDay) : self
 {
     $firstDay->setTime(0, 0, 0);
     $lastDay->setTime(23, 59, 59);
     $this->accountingYear = [$firstDay, $lastDay];
     return $this;
 }
Ejemplo n.º 7
0
 public function hourAction()
 {
     //Define your file path based on the cache one
     $filename = $this->container->getParameter('kernel.cache_dir') . '/timestamps/hour.txt';
     $data = @file_get_contents($filename);
     $now = new \DateTimeImmutable();
     $min = (int) $now->format('i');
     $timestamp = $now->getTimestamp();
     $last = (int) $data ?? 0;
     $diff = $timestamp - $last;
     // can only run in the first 5 mins of an hour,
     // and cannot run again within 10 mins
     $withinMin = $min <= 5;
     if ($withinMin && $diff > 10 * 60) {
         $command = new StatusHourlyCommand();
         $command->setContainer($this->container);
         $input = new ArrayInput([]);
         $output = new NullOutput();
         $resultCode = $command->run($input, $output);
         //Create your own folder in the cache directory
         $fs = new Filesystem();
         $fs->mkdir(dirname($filename));
         file_put_contents($filename, $timestamp);
     } else {
         $resultCode = 1;
     }
     return new JsonResponse((object) ['status' => $resultCode, 'diff' => $diff, 'inWindow' => $withinMin]);
 }
Ejemplo n.º 8
0
 /**
  * @param  \stdClass $obj
  * @param  array     $context
  * @return TwitterEvent
  */
 public function unserialize($obj, array $context = [])
 {
     Assertion::true($this->canUnserialize($obj), 'object is not unserializable');
     $createdAt = new \DateTimeImmutable($obj->created_at);
     Assertion::eq(new \DateTimeZone('UTC'), $createdAt->getTimezone());
     return TwitterEvent::create($obj->event, $this->userSerializer->unserialize($obj->source), isset($obj->target) ? $this->userSerializer->unserialize($obj->target) : null, isset($obj->target_object) ? $this->targetSerializer->unserialize($obj->target_object) : null, $createdAt);
 }
Ejemplo n.º 9
0
 protected static function expired($past, $interval)
 {
     $past = new \DateTimeImmutable($past, new \DateTimeZone('UTC'));
     $future = $past->add(new \DateInterval("PT{$interval}S"));
     $now = new \DateTimeImmutable('2000-10-10 12:30:00', new \DateTimeZone('UTC'));
     return $future <= $now;
 }
Ejemplo n.º 10
0
 /**
  * @param Response $response
  * @param string $cookieName
  * @param string $cookieValue
  * @return Response
  */
 public static function addCookie(Response $response, $cookieName, $cookieValue)
 {
     $expirationMinutes = 10;
     $expiry = new \DateTimeImmutable('now + ' . $expirationMinutes . 'minutes');
     $cookie = urlencode($cookieName) . '=' . urlencode($cookieValue) . '; expires=' . $expiry->format(\DateTime::COOKIE) . '; Max-Age=' . $expirationMinutes * 60 . '; path=/; secure; httponly';
     $response = $response->withAddedHeader('Set-Cookie', $cookie);
     return $response;
 }
Ejemplo n.º 11
0
 /**
  * Return the given ratio of the given interval.
  * @param \DateInterval $interval
  * @param number $ratio 0 to 1
  * @return string
  */
 public static function ratioIntervalString(\DateInterval $interval, $ratio)
 {
     $reference = new \DateTimeImmutable();
     $endTime = $reference->add($interval);
     $seconds = $endTime->getTimestamp() - $reference->getTimestamp();
     $seconds = $seconds * $ratio;
     return sprintf("PT%dS", $seconds);
 }
 public function testTransformDateTimeImmutable()
 {
     $transformer = new DateTimeToTimestampTransformer('Asia/Hong_Kong', 'America/New_York');
     $input = new \DateTimeImmutable('2010-02-03 04:05:06 America/New_York');
     $output = $input->format('U');
     $input = $input->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));
     $this->assertEquals($output, $transformer->transform($input));
 }
Ejemplo n.º 13
0
 public static function getPreviousPeriod(PeriodData $period)
 {
     $previousPeriod = new \StdClass();
     $periodFrom = new \DateTimeImmutable($period->getFrom());
     $previousPeriod->from = $periodFrom->sub(new \DateInterval("P1M"))->format("Y-m-d");
     $previousPeriod->to = $periodFrom->sub(new \DateInterval("P1D"))->format("Y-m-d");
     return $previousPeriod;
 }
 /**
  * @param  \stdClass $directMessage
  * @param  array     $context
  * @return TwitterDirectMessage
  */
 public function unserialize($directMessage, array $context = [])
 {
     Assertion::true($this->canUnserialize($directMessage), 'object is not unserializable');
     $dm = $directMessage->direct_message;
     $createdAt = new \DateTimeImmutable($dm->created_at);
     Assertion::eq(new \DateTimeZone('UTC'), $createdAt->getTimezone());
     return TwitterDirectMessage::create(TwitterMessageId::create($dm->id), $this->userSerializer->unserialize($dm->sender), $this->userSerializer->unserialize($dm->recipient), $dm->text, $createdAt, $this->twitterEntitiesSerializer->canUnserialize($dm->entities) ? $this->twitterEntitiesSerializer->unserialize($dm->entities) : TwitterEntities::create());
 }
 public function testResponseToPropertiesTimestampValue()
 {
     $date = new \DateTimeImmutable();
     $data = ['foo' => ['timestampValue' => $date->format(self::DATE_FORMAT)]];
     $res = $this->mapper->responseToEntityProperties($data)['properties'];
     $this->assertInstanceOf(\DateTimeImmutable::class, $res['foo']);
     $this->assertEquals($date->format('c'), $res['foo']->format('c'));
 }
Ejemplo n.º 16
0
 public function postUp(Schema $schema)
 {
     $lineData = [['bakerloo-line', 'bakerloo', 'Bakerloo', 'Bakerloo Line'], ['central-line', 'central', 'Central', 'Central Line'], ['circle-line', 'circle', 'Circle', 'Circle Line'], ['district-line', 'district', 'District', 'District Line'], ['hammersmith-city-line', 'hammersmith-city', 'Hammersmith & City', 'Hammersmith & City Line'], ['jubilee-line', 'jubilee', 'Jubilee', 'Jubilee Line'], ['metropolitan-line', 'metropolitan', 'Metropolitan', 'Metropolitan Line'], ['northern-line', 'northern', 'Northern', 'Northern Line'], ['piccadilly-line', 'piccadilly', 'Piccadilly', 'Piccadilly Line'], ['victoria-line', 'victoria', 'Victoria', 'Victoria Line'], ['waterloo-city-line', 'waterloo-city', 'Waterloo & City', 'Waterloo & City Line'], ['dlr', 'dlr', 'DLR', 'DLR'], ['london-overground', 'london-overground', 'London Overground', 'London Overground'], ['tfl-rail', 'tfl-rail', 'TFL Rail', 'TFL Rail']];
     $now = new \DateTimeImmutable();
     $iso = $now->format('c');
     foreach ($lineData as $i => $line) {
         $this->addSql('INSERT INTO `tube_lines` (url_key, tfl_key, short_name, name, display_order, created_at, updated_at) VALUES (?,?,?,?,?,?,?)', [$line[0], $line[1], $line[2], $line[3], $i + 1, $iso, $iso]);
     }
 }
Ejemplo n.º 17
0
 public function testDisplayValueForDateTimeImmutable()
 {
     if (PHP_VERSION_ID < 50500) {
         $this->markTestSkipped('\\DateTimeImmutable was introduced in PHP 5.5');
     }
     $now = new \DateTimeImmutable();
     $column = new DateTimeColumn();
     $column->setFormat('Y-m-d H:i:s');
     $this->assertEquals($now->format('Y-m-d H:i:s'), $column->getDisplayedValue($now));
 }
 /**
  * @param int $fromTs
  * @param int $toTs
  *
  * @return \Generator
  */
 public static function generate($fromTs, $toTs)
 {
     $firstDay = new \DateTimeImmutable(date('Y-m-d', $fromTs));
     $lastDay = new \DateTimeImmutable(date('Y-m-d', $toTs));
     $cursor = new \DateTime($lastDay->format('Y-m-d'));
     while ($cursor >= $firstDay) {
         (yield $cursor->format('Y-m-d'));
         $cursor->sub(new \DateInterval('P1D'));
     }
 }
 /**
  * @param Channel $channel
  * @param \DateTimeImmutable $specifiedDate
  * @return array
  */
 public function getListingsOf(Channel $channel, \DateTimeImmutable $specifiedDate)
 {
     $criteria = array('channel' => array('builder' => function ($alias) {
         return sprintf("%s.channel", $alias);
     }, 'value' => $channel), 'programDate' => array('builder' => function ($alias) {
         return sprintf("DATE(%s.programDate)", $alias);
     }, 'value' => $specifiedDate->format('Y-m-d')), 'orderBy' => array('builder' => function ($alias) {
         return sprintf("%s.programDate", $alias);
     }, 'value' => 'ASC'));
     return $this->entityManager->findBy(Listing::class, $criteria);
 }
 public function testTransformDateTimeImmutable()
 {
     if (PHP_VERSION_ID < 50500) {
         $this->markTestSkipped('DateTimeImmutable was introduced in PHP 5.5.0');
     }
     $transformer = new DateTimeToTimestampTransformer('Asia/Hong_Kong', 'America/New_York');
     $input = new \DateTimeImmutable('2010-02-03 04:05:06 America/New_York');
     $output = $input->format('U');
     $input = $input->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));
     $this->assertEquals($output, $transformer->transform($input));
 }
Ejemplo n.º 21
0
 protected function createRequestForSeconds($seconds)
 {
     $interval = new \DateInterval('PT' . abs($seconds) . 'S');
     $date = new \DateTimeImmutable('2015-01-01 00:00:00');
     if ($seconds < 0) {
         $baseDate = $date->add($interval);
     } else {
         $baseDate = $date->sub($interval);
     }
     return new DateDiffRequest($date, $baseDate);
 }
Ejemplo n.º 22
0
 public function test_updating_metadata()
 {
     $mao = $this->registry->getMAO("test");
     $id = MetadataId::generate();
     $mao->save(new Metadata($id, "test", []));
     $metadata = $mao->getBy(['id' => (string) $id]);
     $updatedDate = new \DateTimeImmutable();
     $metadata->without_default = $updatedDate;
     $mao->save($metadata);
     $metadata = $mao->getBy(['id' => (string) $id]);
     $this->assertEquals($updatedDate->format('U'), $metadata->without_default->format('U'));
 }
 /**
  * @test
  */
 function it_creates_a_new_message_from_array_and_fqcn()
 {
     $uuid = Uuid::uuid4();
     $createdAt = new \DateTimeImmutable();
     $command = $this->messageFactory->createMessageFromArray(DoSomething::class, ['uuid' => $uuid->toString(), 'version' => 1, 'payload' => ['command' => 'payload'], 'metadata' => ['command' => 'metadata'], 'created_at' => $createdAt->format(\DateTime::ISO8601)]);
     $this->assertEquals(DoSomething::class, $command->messageName());
     $this->assertEquals($uuid->toString(), $command->uuid()->toString());
     $this->assertEquals($createdAt->format(\DateTime::ISO8601), $command->createdAt()->format(\DateTime::ISO8601));
     $this->assertEquals(1, $command->version());
     $this->assertEquals(['command' => 'payload'], $command->payload());
     $this->assertEquals(['command' => 'metadata'], $command->metadata());
 }
Ejemplo n.º 24
0
 protected function getFormattedDateTime(Episode $episode)
 {
     if (!$episode->firstAired) {
         return 'N/A';
     }
     $date_time = $episode->firstAired->format('D - d/m/Y');
     $today = new \DateTimeImmutable();
     if ($episode->firstAired->format('d/m/y') === $today->format('d/m/y')) {
         $date_time = '<info>' . $date_time . '</info>';
     }
     return $date_time;
 }
Ejemplo n.º 25
0
 /**
  * Convert a UNIX timestamp to a DOS timestamp.
  *
  * @param \DateTimeImmutable $date
  * @return string DOS timestamp
  */
 public static function dostime(\DateTimeImmutable $date)
 {
     // get date array for timestamp
     $d = getdate($date->format('U'));
     // set lower-bound on dates
     if ($d['year'] < 1980) {
         $d = array('year' => 1980, 'mon' => 1, 'mday' => 1, 'hours' => 0, 'minutes' => 0, 'seconds' => 0);
     }
     // remove extra years from 1980
     $d['year'] -= 1980;
     // return date string
     return $d['year'] << 25 | $d['mon'] << 21 | $d['mday'] << 16 | $d['hours'] << 11 | $d['minutes'] << 5 | $d['seconds'] >> 1;
 }
 public function periode($beginn, $interval_spec)
 {
     $anfang_der_periode = new \DateTimeImmutable($beginn);
     $periode = new \DatePeriod($anfang_der_periode, new \DateInterval('P1D'), $anfang_der_periode->add(new \DateInterval($interval_spec)));
     $tage = array();
     foreach ($periode as $datum) {
         $tmp_tag = $this->tag($datum);
         if ($tmp_tag) {
             $tage[] = $tmp_tag;
         }
     }
     return new Periode($tage);
 }
Ejemplo n.º 27
0
 public function setUp()
 {
     $this->description = $this->getMockBuilder('\\Domain\\Context\\Task\\ValueObject\\TaskDescription')->setConstructorArgs(array('don\'t forget the milk'))->setMethods(array('value'))->getMock();
     $this->description->expects($this->any())->method('value')->will($this->returnValue('don\'t forget the milk'));
     $today = new \DateTimeImmutable();
     $this->dueDate = $today->add(new \DateInterval('P1D'));
     $this->task = new Task();
     $this->task->setDueDate($this->dueDate)->setDescription($this->description);
     $mockDueDateSpecification = $this->getMockBuilder('\\Domain\\Context\\Task\\Specification\\TaskFutureDueDate')->setMethods(array('isSatisfiedBy'))->getMock();
     $mockDueDateSpecification->expects($this->any())->method('isSatisfiedBy')->withAnyParameters()->will($this->returnValue(true));
     $this->task->addSpecification($mockDueDateSpecification);
     parent::setUp();
 }
 /**
  * @test
  */
 public function it_publishes_messages()
 {
     $now = new \DateTimeImmutable('now', new \DateTimeZone('UTC'));
     $producer = $this->prophesize(Producer::class);
     $producer->publish(['message_name' => 'test-message', 'uuid' => 'ccefedef-85e1-4fd0-b247-ed13d378b050', 'version' => 1, 'payload' => [], 'metadata' => [], 'created_at' => $now->format('Y-m-d\\TH:i:s.u')], 'test-message', Constants::AMQP_NOPARAM, ['app_id' => 'test_app', 'timestamp' => $now->getTimestamp(), 'type' => 'test-message'])->shouldBeCalled();
     $message = $this->prophesize(Message::class);
     $message->createdAt()->willReturn($now)->shouldBeCalled();
     $message->messageName()->willReturn('test-message')->shouldBeCalled();
     $messageConverter = $this->prophesize(MessageConverter::class);
     $messageConverter->convertToArray($message)->willReturn(['message_name' => 'test-message', 'uuid' => 'ccefedef-85e1-4fd0-b247-ed13d378b050', 'version' => 1, 'payload' => [], 'metadata' => [], 'created_at' => $now])->shouldBeCalled();
     $messageProducer = new AmqpMessageProducer($producer->reveal(), $messageConverter->reveal(), 'test_app');
     $messageProducer($message->reveal());
 }
Ejemplo n.º 29
0
 private function calculateCalendarMonths()
 {
     $months = ((int) $this->date->format('Y') - (int) $this->baseDate->format('Y')) * 12;
     $months += (int) $this->date->format('m') - (int) $this->baseDate->format('m');
     if ($this->date > $this->baseDate) {
         return $months + ($this->date->format('d') < $this->baseDate->format('d') ? -1 : 0);
     } else {
         if ($this->date < $this->baseDate) {
             return $months + ($this->date->format('d') > $this->baseDate->format('d') ? 1 : 0);
         }
     }
     return $months;
 }
Ejemplo n.º 30
-2
 /**
  * @param string $html
  * @return \Lunchbot\Menu\LunchMenuItem[]
  */
 public function parseHtml(string $html) : array
 {
     $crawler = new Crawler();
     $crawler->addContent($html);
     $rows = $crawler->filter('div.entry-content table tr')->each(function (Crawler $node) {
         return $node;
     });
     $todayDayOfWeek = (int) $this->today->format('N');
     $currentDayBlock = false;
     /** @var Crawler $item */
     $result = [];
     foreach ($rows as $item) {
         $headlineTag = $item->children();
         $headline = $headlineTag->text();
         $dayOfWeek = \Nette\Utils\Strings::match($headline, '~^(\\w+)\\s~u')[1] ?? null;
         if (isset(self::$DAYS[$dayOfWeek])) {
             if ($currentDayBlock) {
                 break;
                 // found tomorrow menu block
             } elseif (self::$DAYS[$dayOfWeek] === $todayDayOfWeek) {
                 $currentDayBlock = true;
             }
         } elseif ($currentDayBlock) {
             if (\Nette\Utils\Strings::trim($headline) === 'Dezert') {
                 break;
             }
             $result[] = new LunchMenuItem($headlineTag->siblings()->text());
         }
     }
     return $result;
 }