fetchRepertorire($day, $cinemaId); echo $day; // print_r($movieJson); $filmy = []; foreach ($movieJson->films as $movie) { $film = []; $film['id'] = $movie->id; $film['title'] = $movie->title; $film['times'] = []; $film['date'] = $day; $film['runningtime'] = $movie->info_runningtime; $film['genres'] = []; $film['synopsis_short'] = str_replace(["\r\n", " "], [" "], $movie->synopsis_short); if ($movie->original_s_count > 0 && $movie->show_showings) { foreach ($movie->showings as $shoving) { if ($shoving->date_time == $day) { foreach ($shoving->times as $time) { $film['times'][] = $time->time . " " . $time->screen_type; } } } } foreach ($movie->genres->names as $genre) { $film['genres'][] = $genre->name; } if (count($film['times'])) { $filmy[] = $film; } } // print_r($filmy); die(); return $filmy; } function convertToPrint($day, $cinemaId = null) { $filmy = $this->parseRepertoire($day, $cinemaId); $text = ''; $text .= "Repertuar Multikino GdaƄsk\n"; $text .= $day . "\n\n"; foreach ($filmy as $movie) { $text .= $movie['title']. "\n"; $text .= '('.$movie['runningtime']. ")\n"; $text .= implode(', ', $movie['genres']) . "\n\n"; $text .= $movie['synopsis_short'] . "\n\n"; $text .= implode(', ', $movie['times']) . "\n"; $text .= "--------------------------------\n\n"; } return $text; } }