Skip to content

Commit eab5217

Browse files
committed
cleanup
1 parent 64efe41 commit eab5217

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

Diff for: src/TitleFormatter.php

+4-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class TitleFormatter
99
*
1010
* @var string|null
1111
*/
12-
protected $title = null;
12+
protected $title;
1313

1414
/**
1515
* The separator character for in between words.
@@ -60,12 +60,10 @@ class TitleFormatter
6060
];
6161

6262
/**
63-
* Construct, just needs the title to get going.
64-
*
6563
* @param string $title
6664
* @param string $separator
6765
*/
68-
public function __construct($title, $separator = ' ')
66+
private function __construct($title, $separator = ' ')
6967
{
7068
$this->setTitle($title);
7169
$this->separator = $separator;
@@ -100,10 +98,7 @@ public function convertTitle()
10098
*/
10199
public static function titleCase($title, $separator = ' ')
102100
{
103-
// hack in order to keep static method call
104-
$obj = new TitleFormatter($title, $separator);
105-
106-
return $obj->convertTitle();
101+
return (new self($title, $separator))->convertTitle();
107102
}
108103

109104
/**
@@ -137,7 +132,7 @@ protected function splitWords()
137132
$wordIndex = $this->getWordIndex($word, $offset);
138133

139134
if ($this->hasDash($word)) {
140-
$word = TitleFormatter::titleCase($word, '-');
135+
$word = self::titleCase($word, '-');
141136
$this->rebuildTitle($wordIndex, $word);
142137
}
143138

0 commit comments

Comments
 (0)