@@ -53,6 +53,9 @@ discard block |
||
53 | 53 | return $this->{$type}(); |
54 | 54 | } |
55 | 55 | |
56 | + /** |
|
57 | + * @param string $url |
|
58 | + */ |
|
56 | 59 | public function ajax($url, array $options = [], \Closure $processor = null) |
57 | 60 | { |
58 | 61 | $options['headers'] = array_merge(isset($options['headers']) ? $options['headers'] : [], ['X-Requested-With' => 'XMLHttpRequest']); |
@@ -75,6 +78,9 @@ discard block |
||
75 | 78 | return $crawler; |
76 | 79 | } |
77 | 80 | |
81 | + /** |
|
82 | + * @param string $uri |
|
83 | + */ |
|
78 | 84 | public function model($class, $uri) |
79 | 85 | { |
80 | 86 | return $this->manager->get($class, $uri, $this->initializer($class, $uri)); |
@@ -82,7 +82,7 @@ |
||
82 | 82 | |
83 | 83 | private function initializer($class) |
84 | 84 | { |
85 | - $initializer = function (GhostObjectInterface &$wrappedObject, $method, array $parameters) use ($class) { |
|
85 | + $initializer = function(GhostObjectInterface&$wrappedObject, $method, array $parameters) use ($class) { |
|
86 | 86 | if (!method_exists($wrappedObject, $method)) { |
87 | 87 | return; |
88 | 88 | } |
@@ -121,6 +121,9 @@ |
||
121 | 121 | return $sessions; |
122 | 122 | } |
123 | 123 | |
124 | + /** |
|
125 | + * @param Event $event |
|
126 | + */ |
|
124 | 127 | public function getComments($event) |
125 | 128 | { |
126 | 129 | $comments = $this->crawler->filter('.comments .comment')->each(function (Crawler $node) use ($event) { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | { |
82 | 82 | $sessions = new ArrayCollection(); |
83 | 83 | |
84 | - $this->crawler->filter('#snippet--program dt')->each(function (Crawler $dt) use ($sessions, $event) { |
|
84 | + $this->crawler->filter('#snippet--program dt')->each(function(Crawler $dt) use ($sessions, $event) { |
|
85 | 85 | $session = new Session(); |
86 | 86 | $session->setEvent($event); |
87 | 87 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $sessions->add($session); |
98 | 98 | }); |
99 | 99 | |
100 | - $this->crawler->filter('#snippet--program dd')->each(function (Crawler $dd, $i) use ($sessions) { |
|
100 | + $this->crawler->filter('#snippet--program dd')->each(function(Crawler $dd, $i) use ($sessions) { |
|
101 | 101 | $session = $sessions[$i]; |
102 | 102 | if (preg_match('/program-type-([^ ]+)/', $dd->attr('class'), $matches)) { |
103 | 103 | $session->setType($matches[1]); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | public function getComments($event) |
125 | 125 | { |
126 | - $comments = $this->crawler->filter('.comments .comment')->each(function (Crawler $node) use ($event) { |
|
126 | + $comments = $this->crawler->filter('.comments .comment')->each(function(Crawler $node) use ($event) { |
|
127 | 127 | $date = trim($node->filter('.comment-date')->text()); |
128 | 128 | $date = \DateTime::createFromFormat('d. m. Y v H:i', $date, new \DateTimeZone('Europe/Prague')); |
129 | 129 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | { |
38 | 38 | $url = $event->getUri().'?what=yes&do=showAll'; |
39 | 39 | |
40 | - $crawler = $this->client->ajax($url, [], function ($response) { |
|
40 | + $crawler = $this->client->ajax($url, [], function($response) { |
|
41 | 41 | return $this->getAttendeesSnippet($response, 'snippet--visitorsallyes'); |
42 | 42 | }); |
43 | 43 | $page = new AttendeesPage($crawler, $this->client); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | $url = $event->getUri().'?what=maybe&do=showAll'; |
54 | 54 | |
55 | - $crawler = $this->client->ajax($url, [], function ($response) { |
|
55 | + $crawler = $this->client->ajax($url, [], function($response) { |
|
56 | 56 | return $this->getAttendeesSnippet($response, 'snippet--visitorsallmaybe'); |
57 | 57 | }); |
58 | 58 | $page = new AttendeesPage($crawler, $this->client); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | public function getAttendees() |
22 | 22 | { |
23 | - $attendees = $this->crawler->filter('.attendee-name')->each(function (Crawler $node) { |
|
23 | + $attendees = $this->crawler->filter('.attendee-name')->each(function(Crawler $node) { |
|
24 | 24 | $uri = $node->link()->getUri(); |
25 | 25 | |
26 | 26 | $user = $this->client->model(User::class, $uri); |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | public function getEvents(Series $series) |
40 | 40 | { |
41 | - $events = $this->crawler->filter('.event-main .row .row')->each(function (Crawler $row) use ($series) { |
|
41 | + $events = $this->crawler->filter('.event-main .row .row')->each(function(Crawler $row) use ($series) { |
|
42 | 42 | $uri = $row->filter('h4 a')->link()->getUri(); |
43 | 43 | $event = $this->client->model(Event::class, $uri); |
44 | 44 | $event->setSeries($series); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | { |
21 | 21 | public function getUsers() |
22 | 22 | { |
23 | - $users = $this->crawler->filter('.user-list a')->each(function (Crawler $node) { |
|
23 | + $users = $this->crawler->filter('.user-list a')->each(function(Crawler $node) { |
|
24 | 24 | $uri = $node->link()->getUri(); |
25 | 25 | |
26 | 26 | /* @var $user User */ |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | { |
22 | 22 | public function getSeries() |
23 | 23 | { |
24 | - $series = $this->crawler->filter('.body-default .span6:first-child h3 a')->each(function (Crawler $link) { |
|
24 | + $series = $this->crawler->filter('.body-default .span6:first-child h3 a')->each(function(Crawler $link) { |
|
25 | 25 | $uri = $link->link()->getUri(); |
26 | 26 | $series = $this->client->model(Series::class, $uri); |
27 | 27 | $series->setName($link->text()); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | public function getUsers() |
37 | 37 | { |
38 | - $users = $this->crawler->filter('.body-default .span6 + .span6 h3 a')->each(function (Crawler $link) { |
|
38 | + $users = $this->crawler->filter('.body-default .span6 + .span6 h3 a')->each(function(Crawler $link) { |
|
39 | 39 | $uri = $link->link()->getUri(); |
40 | 40 | $user = $this->client->model(User::class, $uri); |
41 | 41 | $user->setName($link->text()); |