Skip to content

Commit

Permalink
Merge branch 'release/6.0.22'
Browse files Browse the repository at this point in the history
* release/6.0.22:
  wip
  fixed nullable values in the helper methods
  • Loading branch information
austintoddj committed Feb 5, 2021
2 parents d8d79c7 + ff2f209 commit 3abfeb1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 30 deletions.
8 changes: 4 additions & 4 deletions src/Canvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,21 @@ public static function gravatar(string $email, int $size = 200, string $default
/**
* Return true if dark mode is enabled.
*
* @param int $enabled
* @param int|null $enabled
* @return bool
*/
public static function enabledDarkMode(int $enabled): bool
public static function enabledDarkMode(?int $enabled): bool
{
return (bool) $enabled ?: false;
}

/**
* Return true if the app is configured to use Arabic or Farsi.
*
* @param string $locale
* @param string|null $locale
* @return bool
*/
public static function usingRightToLeftLanguage(string $locale): bool
public static function usingRightToLeftLanguage(?string $locale): bool
{
return in_array($locale, ['ar', 'fa']);
}
Expand Down
6 changes: 4 additions & 2 deletions tests/CanvasTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public function testURLIsValid(): void

public function testTrimURL(): void
{
$url = Canvas::trimUrl('https://www.example.com?string-to-trim');
$this->assertSame(Canvas::trimUrl('https://www.example.com?string-to-trim'), 'www.example.com');

$this->assertSame($url, 'www.example.com');
$this->assertNull(Canvas::trimUrl(null));
}

public function testGravatar(): void
Expand All @@ -90,12 +90,14 @@ public function testEnabledDarkMode(): void
{
$this->assertTrue(Canvas::enabledDarkMode(1));
$this->assertFalse(Canvas::enabledDarkMode(0));
$this->assertFalse(Canvas::enabledDarkMode(null));
}

public function testUsingRightToLeftLanguage(): void
{
$this->assertTrue(Canvas::usingRightToLeftLanguage('ar'));
$this->assertTrue(Canvas::usingRightToLeftLanguage('fa'));
$this->assertFalse(Canvas::usingRightToLeftLanguage('en'));
$this->assertFalse(Canvas::usingRightToLeftLanguage(null));
}
}
48 changes: 24 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
source-map "^0.5.0"

"@babel/generator@^7.12.13":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.13.tgz#5f6ebe6c85db99886db2d7b044409196f872a503"
integrity sha512-9qQ8Fgo8HaSvHEt6A5+BATP7XktD/AdAnObUeTRz5/e2y3kbrxZgz32qUJJsdmwUvBJzF4AeV21nGTNwv05Mpw==
version "7.12.15"
resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.12.15.tgz#4617b5d0b25cc572474cc1aafee1edeaf9b5368f"
integrity sha512-6F2xHxBiFXWNSGb7vyCUTBF8RCLY66rS0zEPcP8t/nQyXjha5EuK4z7H5o7fWG8B4M7y6mqVWq1J+1PuwRhecQ==
dependencies:
"@babel/types" "^7.12.13"
jsesc "^2.5.1"
Expand Down Expand Up @@ -238,9 +238,9 @@
js-tokens "^4.0.0"

"@babel/parser@^7.12.13", "@babel/parser@^7.7.0":
version "7.12.14"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.14.tgz#4adb7c5eef1d437ef965ad1569cd826db8c11dc9"
integrity sha512-xcfxDq3OrBnDsA/Z8eK5/2iPcLD8qbOaSSfOw4RA6jp4i7e6dEQ7+wTwxItEwzcXPQcsry5nZk96gmVPKletjQ==
version "7.12.15"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.15.tgz#2b20de7f0b4b332d9b119dd9c33409c538b8aacf"
integrity sha512-AQBOU2Z9kWwSZMd6lNjCX0GUgFonL1wAM1db8L8PMk9UDaGsRCArBkU4Sc+UCM3AE4hjbXx+h58Lb3QT4oRmrA==

"@babel/plugin-proposal-async-generator-functions@^7.12.13":
version "7.12.13"
Expand Down Expand Up @@ -631,9 +631,9 @@
"@babel/helper-plugin-utils" "^7.12.13"

"@babel/plugin-transform-runtime@^7.12.1":
version "7.12.13"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.12.13.tgz#93a47630c80dab152a2b71011d1e1fd37b31b8e1"
integrity sha512-ho1CV2lm8qn2AxD3JdvPgtLVHCYLDaOszlf0gosdHcJAIfgNizag76WI+FoibrvfT+h117fgf8h+wgvo4O2qbA==
version "7.12.15"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.12.15.tgz#4337b2507288007c2b197059301aa0af8d90c085"
integrity sha512-OwptMSRnRWJo+tJ9v9wgAf72ydXWfYSXWhnQjZing8nGZSDFqU1MBleKM3+DriKkcbv7RagA8gVeB0A1PNlNow==
dependencies:
"@babel/helper-module-imports" "^7.12.13"
"@babel/helper-plugin-utils" "^7.12.13"
Expand Down Expand Up @@ -1868,9 +1868,9 @@ caniuse-api@^3.0.0:
lodash.uniq "^4.5.0"

caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001181:
version "1.0.30001183"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001183.tgz#7a57ba9d6584119bb5f2bc76d3cc47ba9356b3e2"
integrity sha512-7JkwTEE1hlRKETbCFd8HDZeLiQIUcl8rC6JgNjvHCNaxOeNmQ9V4LvQXRUsKIV2CC73qKxljwVhToaA3kLRqTw==
version "1.0.30001185"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001185.tgz#3482a407d261da04393e2f0d61eefbc53be43b95"
integrity sha512-Fpi4kVNtNvJ15H0F6vwmXtb3tukv3Zg3qhKkOGUq7KJ1J6b9kf4dnNgtEAFXhRsJo0gNj9W60+wBvn0JcTvdTg==

chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.1, chalk@^2.4.2:
version "2.4.2"
Expand Down Expand Up @@ -2792,9 +2792,9 @@ [email protected]:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=

electron-to-chromium@^1.3.649:
version "1.3.653"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.653.tgz#1d98400eba330538a7fe169808c6bf9d83c44450"
integrity sha512-LehOhcl74u9fkV9Un6WahJ+Xh+0FZLCCDnKYis1Olx1DX2ugRww5PJicE65OG8yznMj8EOQZRcz6FSV1xKxqsA==
version "1.3.655"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.655.tgz#e5ccf5c445ca131fea9d0698d08cc9c8ca01fa81"
integrity sha512-b+V6KreLR1SvNBY1WOZWsm5Dc/ZC/B5/E1m5TpUrWnEwrd1pJgKgsrLYtQYTDgdTj1/QoZE7qMPIeJ6hZwpsVA==

elliptic@^6.5.3:
version "6.5.4"
Expand Down Expand Up @@ -3596,9 +3596,9 @@ fsevents@^1.2.7:
nan "^2.12.1"

fsevents@~2.3.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.1.tgz#b209ab14c61012636c8863507edf7fb68cc54e9f"
integrity sha512-YR47Eg4hChJGAB1O3yEAOkGO+rlzutoICGqGo9EZ4lKWokzZRSyIW1QmTzqjtw8MJdj9srP869CuWw/hyzSiBw==
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==

function-bind@^1.1.1:
version "1.1.1"
Expand Down Expand Up @@ -3715,9 +3715,9 @@ globby@^11.0.1:
slash "^3.0.0"

graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.2.0, graceful-fs@^4.2.2, graceful-fs@^4.2.4:
version "4.2.4"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==
version "4.2.5"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.5.tgz#bc18864a6c9fc7b303f2e2abdb9155ad178fbe29"
integrity sha512-kBBSQbz2K0Nyn+31j/w36fUfxkBW9/gfwRWdUY1ULReH3iokVJgddZAFcD1D0xlgTmFxJCbUkUclAlc6/IDJkw==

growly@^1.3.0:
version "1.3.0"
Expand Down Expand Up @@ -7540,9 +7540,9 @@ webpack-sources@^2.1.1:
source-map "^0.6.1"

webpack@^5.1.3:
version "5.20.2"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.20.2.tgz#55a6e461e2a6e1ca7467a419886acf9c7b052d5f"
integrity sha512-gGPip54KK7DznaaPHVuNGqym3LAXXL+bPkZ9SlLTCdHmmk+m5x+D4UZdhWvw32CMahYlZwZYPsioFIw36/txYQ==
version "5.21.0"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.21.0.tgz#0dac2d97a2b274f2bd14c043d60cba11e0eb2198"
integrity sha512-DoFw0eAPbh2DXyBn0nP5lMnytPXlkLsdXOpBQyibf+1OCnThxUVPzMbth/+JS97HN0mfl7OhLmEKLw+kg0jmkg==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.46"
Expand Down

0 comments on commit 3abfeb1

Please sign in to comment.