PluginProbe
Media Cloud Sync / 1.2.3
Media Cloud Sync v1.2.3
1.4.2 1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 All 36 releases
media-cloud-sync / includes / sdk / s3 / GuzzleHttp / Psr7 / UriComparator.php

UriComparator.php in Media Cloud Sync 1.2.3, at includes/sdk/s3/GuzzleHttp/Psr7/UriComparator.php

48 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\GuzzleHttp\Psr7;
4
5 use Dudlewebs\WPMCS\s3\Psr\Http\Message\UriInterface;
6 /**
7 * Provides methods to determine if a modified URL should be considered cross-origin.
8 *
9 * @author Graham Campbell
10 */
11 final class UriComparator
12 {
13 /**
14 * Determines if a modified URL should be considered cross-origin with
15 * respect to an original URL.
16 *
17 * @return bool
18 */
19 public static function isCrossOrigin(UriInterface $original, UriInterface $modified)
20 {
21 if (\strcasecmp($original->getHost(), $modified->getHost()) !== 0) {
22 return \true;
23 }
24 if ($original->getScheme() !== $modified->getScheme()) {
25 return \true;
26 }
27 if (self::computePort($original) !== self::computePort($modified)) {
28 return \true;
29 }
30 return \false;
31 }
32 /**
33 * @return int
34 */
35 private static function computePort(UriInterface $uri)
36 {
37 $port = $uri->getPort();
38 if (null !== $port) {
39 return $port;
40 }
41 return 'https' === $uri->getScheme() ? 443 : 80;
42 }
43 private function __construct()
44 {
45 // cannot be instantiated
46 }
47 }
48