PluginProbe
Depicter — Popup & Slider Builder / 1.9.2
Depicter — Popup & Slider Builder v1.9.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / vendor / guzzlehttp / psr7 / src / UriComparator.php

UriComparator.php in Depicter — Popup & Slider Builder 1.9.2, at vendor/guzzlehttp/psr7/src/UriComparator.php

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