Skip to content

Commit de94532

Browse files
committed
Added Move Static Member exercise
1 parent 049afc4 commit de94532

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* Move Static Member
4+
*
5+
* Move static fields and methods to another type.
6+
*
7+
* F6 (Windows/Linux/Mac OS X)
8+
*/
9+
10+
namespace Refactoring15\JetBrains;
11+
12+
// 1. Move the static method "split" from the class Utils to a more specialized StringUtils.
13+
class Utils {
14+
public static function split($subject, $delimiter)
15+
{
16+
return explode($delimiter, $subject);
17+
}
18+
}
19+
20+
class StringUtils {
21+
}
22+
23+
// 2. Note that calls to Utils::split() have updated to StringUtils::split()
24+
$myArray = Utils::split('This is a test', ' ');
25+
$myCsvRecord = Utils::split('Maarten;JetBrains', ';');

0 commit comments

Comments
 (0)