Completed
Branch FET/11251/url-vo (15e3bf)
by
unknown
78:46 queued 67:53
created
core/domain/values/Url.php 2 patches
Indentation   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -21,163 +21,163 @@
 block discarded – undo
21 21
 class Url
22 22
 {
23 23
 
24
-    /**
25
-     * @var string $scheme
26
-     */
27
-    private $scheme;
28
-
29
-    /**
30
-     * @var string $host
31
-     */
32
-    private $host;
33
-
34
-    /**
35
-     * @var string $path
36
-     */
37
-    private $path;
38
-
39
-    /**
40
-     * @var string $query_string
41
-     */
42
-    private $query_string;
43
-
44
-    /**
45
-     * @var string $fragment
46
-     */
47
-    private $fragment;
48
-
49
-
50
-    /**
51
-     * Url constructor.
52
-     *
53
-     * @param $url
54
-     * @throws InvalidArgumentException
55
-     */
56
-    public function __construct($url)
57
-    {
58
-        if (
59
-            ! filter_var(
60
-                $url,
61
-                FILTER_VALIDATE_URL,
62
-                array(FILTER_FLAG_SCHEME_REQUIRED, FILTER_FLAG_HOST_REQUIRED)
63
-            )
64
-        ) {
65
-            throw new InvalidArgumentException(esc_html__('Invalid URL. Both the "Scheme" and "Host" are required.',
66
-                'event_espresso'));
67
-        }
68
-        $url = parse_url($url);
69
-        $this->setScheme($url);
70
-        $this->setHost($url);
71
-        $this->setPath($url);
72
-        $this->setQueryString($url);
73
-        $this->setFragment($url);
74
-    }
75
-
76
-
77
-    /**
78
-     * @return string
79
-     */
80
-    public function scheme()
81
-    {
82
-        return $this->scheme;
83
-    }
84
-
85
-
86
-    /**
87
-     * @param array $url
88
-     */
89
-    private function setScheme($url)
90
-    {
91
-        $this->scheme = $url['scheme'] . '://';
92
-    }
93
-
94
-
95
-    /**
96
-     * @return string
97
-     */
98
-    public function host()
99
-    {
100
-        return $this->host;
101
-    }
102
-
103
-
104
-    /**
105
-     * @param array $url
106
-     */
107
-    private function setHost($url)
108
-    {
109
-        $this->host = $url['host'];
110
-    }
111
-
112
-
113
-    /**
114
-     * @return string
115
-     */
116
-    public function path()
117
-    {
118
-        return $this->path;
119
-    }
120
-
121
-
122
-    /**
123
-     * @param array $url
124
-     */
125
-    private function setPath($url)
126
-    {
127
-        $this->path = isset($url['path']) ? $url['path'] : '';
128
-    }
129
-
130
-
131
-    /**
132
-     * @return string
133
-     */
134
-    public function queryString()
135
-    {
136
-        return $this->query_string !== '' ? '?' . $this->query_string : '';
137
-    }
138
-
139
-
140
-    /**
141
-     * @param array $url
142
-     */
143
-    private function setQueryString($url)
144
-    {
145
-        $this->query_string = isset($url['query']) ? $url['query'] : '';
146
-    }
147
-
148
-
149
-    /**
150
-     * @return string
151
-     */
152
-    public function fragment()
153
-    {
154
-        return $this->fragment !== '' ? '#' . $this->fragment : '';
155
-    }
156
-
157
-
158
-    /**
159
-     * @param array $url
160
-     */
161
-    private function setFragment($url)
162
-    {
163
-        $this->fragment = isset($url['fragment']) ? $url['fragment'] : '';
164
-    }
165
-
166
-
167
-    /**
168
-     * @return string
169
-     */
170
-    public function getFullUrl()
171
-    {
172
-        return $this->scheme() . $this->host() . $this->path() . $this->queryString() . $this->fragment();
173
-    }
174
-
175
-
176
-    /**
177
-     * @return string
178
-     */
179
-    public function __toString()
180
-    {
181
-        return $this->getFullUrl();
182
-    }
24
+	/**
25
+	 * @var string $scheme
26
+	 */
27
+	private $scheme;
28
+
29
+	/**
30
+	 * @var string $host
31
+	 */
32
+	private $host;
33
+
34
+	/**
35
+	 * @var string $path
36
+	 */
37
+	private $path;
38
+
39
+	/**
40
+	 * @var string $query_string
41
+	 */
42
+	private $query_string;
43
+
44
+	/**
45
+	 * @var string $fragment
46
+	 */
47
+	private $fragment;
48
+
49
+
50
+	/**
51
+	 * Url constructor.
52
+	 *
53
+	 * @param $url
54
+	 * @throws InvalidArgumentException
55
+	 */
56
+	public function __construct($url)
57
+	{
58
+		if (
59
+			! filter_var(
60
+				$url,
61
+				FILTER_VALIDATE_URL,
62
+				array(FILTER_FLAG_SCHEME_REQUIRED, FILTER_FLAG_HOST_REQUIRED)
63
+			)
64
+		) {
65
+			throw new InvalidArgumentException(esc_html__('Invalid URL. Both the "Scheme" and "Host" are required.',
66
+				'event_espresso'));
67
+		}
68
+		$url = parse_url($url);
69
+		$this->setScheme($url);
70
+		$this->setHost($url);
71
+		$this->setPath($url);
72
+		$this->setQueryString($url);
73
+		$this->setFragment($url);
74
+	}
75
+
76
+
77
+	/**
78
+	 * @return string
79
+	 */
80
+	public function scheme()
81
+	{
82
+		return $this->scheme;
83
+	}
84
+
85
+
86
+	/**
87
+	 * @param array $url
88
+	 */
89
+	private function setScheme($url)
90
+	{
91
+		$this->scheme = $url['scheme'] . '://';
92
+	}
93
+
94
+
95
+	/**
96
+	 * @return string
97
+	 */
98
+	public function host()
99
+	{
100
+		return $this->host;
101
+	}
102
+
103
+
104
+	/**
105
+	 * @param array $url
106
+	 */
107
+	private function setHost($url)
108
+	{
109
+		$this->host = $url['host'];
110
+	}
111
+
112
+
113
+	/**
114
+	 * @return string
115
+	 */
116
+	public function path()
117
+	{
118
+		return $this->path;
119
+	}
120
+
121
+
122
+	/**
123
+	 * @param array $url
124
+	 */
125
+	private function setPath($url)
126
+	{
127
+		$this->path = isset($url['path']) ? $url['path'] : '';
128
+	}
129
+
130
+
131
+	/**
132
+	 * @return string
133
+	 */
134
+	public function queryString()
135
+	{
136
+		return $this->query_string !== '' ? '?' . $this->query_string : '';
137
+	}
138
+
139
+
140
+	/**
141
+	 * @param array $url
142
+	 */
143
+	private function setQueryString($url)
144
+	{
145
+		$this->query_string = isset($url['query']) ? $url['query'] : '';
146
+	}
147
+
148
+
149
+	/**
150
+	 * @return string
151
+	 */
152
+	public function fragment()
153
+	{
154
+		return $this->fragment !== '' ? '#' . $this->fragment : '';
155
+	}
156
+
157
+
158
+	/**
159
+	 * @param array $url
160
+	 */
161
+	private function setFragment($url)
162
+	{
163
+		$this->fragment = isset($url['fragment']) ? $url['fragment'] : '';
164
+	}
165
+
166
+
167
+	/**
168
+	 * @return string
169
+	 */
170
+	public function getFullUrl()
171
+	{
172
+		return $this->scheme() . $this->host() . $this->path() . $this->queryString() . $this->fragment();
173
+	}
174
+
175
+
176
+	/**
177
+	 * @return string
178
+	 */
179
+	public function __toString()
180
+	{
181
+		return $this->getFullUrl();
182
+	}
183 183
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
      */
89 89
     private function setScheme($url)
90 90
     {
91
-        $this->scheme = $url['scheme'] . '://';
91
+        $this->scheme = $url['scheme'].'://';
92 92
     }
93 93
 
94 94
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function queryString()
135 135
     {
136
-        return $this->query_string !== '' ? '?' . $this->query_string : '';
136
+        return $this->query_string !== '' ? '?'.$this->query_string : '';
137 137
     }
138 138
 
139 139
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
      */
152 152
     public function fragment()
153 153
     {
154
-        return $this->fragment !== '' ? '#' . $this->fragment : '';
154
+        return $this->fragment !== '' ? '#'.$this->fragment : '';
155 155
     }
156 156
 
157 157
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function getFullUrl()
171 171
     {
172
-        return $this->scheme() . $this->host() . $this->path() . $this->queryString() . $this->fragment();
172
+        return $this->scheme().$this->host().$this->path().$this->queryString().$this->fragment();
173 173
     }
174 174
 
175 175
 
Please login to merge, or discard this patch.