We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cf2b6d5 commit 7c44f93Copy full SHA for 7c44f93
workshop/05_Refactoring/16_Make_Static.php
@@ -0,0 +1,31 @@
1
+<?php
2
+/**
3
+ * Make Static
4
+ *
5
+ * Make method static.
6
7
+ */
8
+
9
+namespace Refactoring16\JetBrains;
10
11
+// 1. Make method split static.
12
+class Splitter
13
+{
14
+ private $delimiter;
15
16
+ public function __construct($delimiter)
17
+ {
18
+ $this->delimiter = $delimiter;
19
+ }
20
21
+ public function split($subject)
22
23
+ return explode($this->delimiter, $subject);
24
25
+}
26
27
+// 2. Note that calls to Splitter::split() have updated to static calls
28
+// as well as a new argument with instance have been provided.
29
+$splitter = new Splitter(' ');
30
+$myArray = $splitter->split('This is a test');
31
+$myCsvRecord = $splitter->split('PhpStorm JetBrains');
0 commit comments