Skip to content

Commit

Permalink
TASK: Revert renaming of API method names
Browse files Browse the repository at this point in the history
Revert it to not break all uses of the package out there.

Updated README.md via
```
./build/generate-docs
```
  • Loading branch information
alexander-nitsche committed Apr 20, 2023
1 parent f3841ad commit 44b4a7b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ For a complete documentation of all classes, read the generated [PHPDoc](doc).

Create a new Syllable class, with defaults.

### public static setDirectoryCache(string $dir)
### public static setCacheDir(string $dir)

Set the directory where compiled language files may be stored.
Default to the `cache` subdirectory of the current directory.
Expand All @@ -52,7 +52,7 @@ Default to the `cache` subdirectory of the current directory.
Set the character encoding to use.
Specify `null` encoding to not apply any encoding at all.

### public static setDirectoryLanguage(string $dir)
### public static setLanguageDir(string $dir)

Set the directory where language source files can be found.
Default to the `languages` subdirectory of the current directory.
Expand Down
24 changes: 12 additions & 12 deletions src/Syllable.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class Syllable
* @var string|null
*/
private static $encoding = 'UTF-8';
private static $directoryCache = null;
private static $directoryLanguage = null;
private static $cacheDir = null;
private static $languageDir = null;
private $excludes = [];
private $includes = [];

Expand All @@ -79,13 +79,13 @@ class Syllable
*/
public function __construct($language = 'en', $hyphen = null)
{
if (!self::$directoryCache) {
self::$directoryCache = __DIR__.'/../cache';
if (!self::$cacheDir) {
self::$cacheDir = __DIR__.'/../cache';
}
$this->setCache(new Json(self::$directoryCache));
$this->setCache(new Json(self::$cacheDir));

if (!self::$directoryLanguage) {
self::$directoryLanguage = __DIR__.'/../languages';
if (!self::$languageDir) {
self::$languageDir = __DIR__.'/../languages';
}

$this->setLanguage($language);
Expand All @@ -99,9 +99,9 @@ public function __construct($language = 'en', $hyphen = null)
*
* @param string $dir
*/
public static function setDirectoryCache($dir)
public static function setCacheDir($dir)
{
self::$directoryCache = $dir;
self::$cacheDir = $dir;
}

/**
Expand All @@ -121,9 +121,9 @@ public static function setEncoding($encoding = null)
*
* @param string $dir
*/
public static function setDirectoryLanguage($dir)
public static function setLanguageDir($dir)
{
self::$directoryLanguage = $dir;
self::$languageDir = $dir;
}

/**
Expand All @@ -134,7 +134,7 @@ public static function setDirectoryLanguage($dir)
public function setLanguage($language)
{
$this->language = $language;
$this->setSource(new File($language, self::$directoryLanguage));
$this->setSource(new File($language, self::$languageDir));
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/src/SyllableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ protected function setUpFixture()
{
$this->createTestDirectory();

Syllable::setDirectoryCache($this->getTestDirectory());
Syllable::setDirectoryLanguage(realpath(__DIR__.'/../../languages'));
Syllable::setCacheDir($this->getTestDirectory());
Syllable::setLanguageDir(realpath(__DIR__.'/../../languages'));

$this->object = new Syllable();
}
Expand Down

0 comments on commit 44b4a7b

Please sign in to comment.