Skip to content

Commit

Permalink
Add some return values to functions
Browse files Browse the repository at this point in the history
  • Loading branch information
davide-casiraghi committed Mar 21, 2020
1 parent b942eb2 commit c06313f
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Models/Continent.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Continent extends Model
*
* @return \DavideCasiraghi\LaravelEventsCalendar\Models\Continent
*/
public static function getContinents()
public static function getContinents(): iterable
{
$seconds = 86400; // One day
$ret = Cache::remember('continents_list', $seconds, function () {
Expand Down
10 changes: 5 additions & 5 deletions src/Models/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Country extends Model
*
* @return \DavideCasiraghi\LaravelEventsCalendar\Models\Country
*/
public static function getCountries()
public static function getCountries(): iterable
{
$seconds = 86400; // One day
$ret = Cache::remember('countries_list', $seconds, function () {
Expand All @@ -45,7 +45,7 @@ public static function getCountries()
*
* @return \DavideCasiraghi\LaravelEventsCalendar\Models\Country
*/
public static function getActiveCountries()
public static function getActiveCountries(): ?iterable
{
$seconds = 900; // 15 minutes

Expand Down Expand Up @@ -76,7 +76,7 @@ public static function getActiveCountries()
*
* @return \DavideCasiraghi\LaravelEventsCalendar\Models\Country
*/
public static function getActiveCountriesByContinent($continent_id)
public static function getActiveCountriesByContinent($continent_id): ?iterable
{
$activeCountries = self::getActiveCountries()->unique('name')->sortBy('name');
$ret = $activeCountries->where('continent_id', $continent_id);
Expand All @@ -91,7 +91,7 @@ public static function getActiveCountriesByContinent($continent_id)
*
* @return \Illuminate\Support\Collection
*/
public static function getCountriesWithTeachers()
public static function getCountriesWithTeachers(): ?iterable
{
$ret = self::join('teachers', 'countries.id', '=', 'teachers.country_id')
->orderBy('countries.name')->pluck('countries.name', 'countries.id');
Expand Down Expand Up @@ -123,7 +123,7 @@ public static function getCountriesWithTeachers()
* @param int $countryId
* @return string
*/
public static function getCountryName($countryId)
public static function getCountryName($countryId): string
{
$country = self::select('name')->where('id', $countryId)->get();
$ret = $country[0]['name'];
Expand Down
2 changes: 1 addition & 1 deletion src/Models/EventCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class EventCategory extends Model
* @param int $categoryId
* @return string
*/
public static function getCategoryName($categoryId)
public static function getCategoryName($categoryId): string
{
$ret = self::find($categoryId)->name;

Expand Down
4 changes: 2 additions & 2 deletions src/Models/EventVenue.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function user()
* @param int $venueId
* @return string
*/
public static function getVenueName($venueId)
public static function getVenueName($venueId): string
{
$ret = self::find($venueId)->name;

Expand All @@ -56,7 +56,7 @@ public static function getVenueName($venueId)
* @param int $venueId
* @return bool
*/
public static function venueContainsEvents($venueId)
public static function venueContainsEvents($venueId): bool
{
$events = Event::where('venue_id', '=', $venueId)->first();
if ($events === null) {
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Region.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Region extends Model
* @param int $regionId
* @return string
*/
public static function getRegionName($regionId)
public static function getRegionName($regionId): string
{
$ret = self::find($regionId)->name;

Expand Down

0 comments on commit c06313f

Please sign in to comment.