Skip to content

Commit 6d62422

Browse files
Replace invalid "en" with "en-us" as default language of Syllable
Updated API documentation via ``` ./build/generate-docs ```
1 parent 801e676 commit 6d62422

3 files changed

Lines changed: 2 additions & 24 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ The following describes the API of the main Syllable class. In most cases,
8989
you will not use any other functions. Browse the code under src/ for all
9090
available functions.
9191

92-
#### public __construct($language = 'en', string|Hyphen $hyphen = null)
92+
#### public __construct($language = 'en-us', string|Hyphen $hyphen = null)
9393

9494
Create a new Syllable class, with defaults.
9595

src/Syllable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class Syllable
7777
* @param string $language
7878
* @param string|Hyphen $hyphen
7979
*/
80-
public function __construct($language = 'en', $hyphen = null)
80+
public function __construct($language = 'en-us', $hyphen = null)
8181
{
8282
if (!self::$cacheDir) {
8383
self::$cacheDir = __DIR__.'/../cache';

tests/src/SyllableTest.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ public function testSetLanguage()
7676
*/
7777
public function testSetHyphen()
7878
{
79-
$this->object->setLanguage('en-us');
80-
8179
$this->object->setHyphen('-');
8280
$this->assertEquals(
8381
'Su-per-cal-ifrag-ilis-tic-ex-pi-ali-do-cious',
@@ -247,7 +245,6 @@ public function dataSplitWord()
247245
public function testSplitWord($word, $expected)
248246
{
249247
$this->object->setHyphen('-');
250-
$this->object->setLanguage('en-us');
251248

252249
$this->assertEquals($expected, $this->object->splitWord($word));
253250
}
@@ -273,7 +270,6 @@ public function dataSplitWordDoesNotSupportPunctuation()
273270
public function testSplitWordDoesNotSupportPunctuation($word, $expected)
274271
{
275272
$this->object->setHyphen('-');
276-
$this->object->setLanguage('en-us');
277273

278274
$this->assertEquals($expected, $this->object->splitWord($word));
279275
}
@@ -325,7 +321,6 @@ public function dataSplitWordDoesNotAlwaysProvideFullHyphenation()
325321
public function testSplitWordDoesNotAlwaysProvideFullHyphenation($word, $expected)
326322
{
327323
$this->object->setHyphen('-');
328-
$this->object->setLanguage('en-us');
329324

330325
$this->assertEquals($expected, $this->object->splitWord($word));
331326
}
@@ -415,7 +410,6 @@ public function dataSplitWords()
415410
public function testSplitWords($text, $expected)
416411
{
417412
$this->object->setHyphen('-');
418-
$this->object->setLanguage('en-us');
419413

420414
$this->assertEquals($expected, $this->object->splitWords($text));
421415
}
@@ -476,7 +470,6 @@ public function dataSplitText()
476470
public function testSplitText($text, $expected)
477471
{
478472
$this->object->setHyphen('-');
479-
$this->object->setLanguage('en-us');
480473

481474
$this->assertEquals($expected, $this->object->splitText($text));
482475
}
@@ -487,7 +480,6 @@ public function testSplitText($text, $expected)
487480
public function testHyphenateWord()
488481
{
489482
$this->object->setHyphen('-');
490-
$this->object->setLanguage('en-us');
491483

492484
$this->assertEquals(
493485
';Re-dun-dan-t, punc-tu-a-tion...',
@@ -502,7 +494,6 @@ public function testHyphenateWord()
502494
public function testHyphenateText()
503495
{
504496
$this->object->setHyphen('-');
505-
$this->object->setLanguage('en-us');
506497

507498
$this->assertEquals(
508499
';Re-dun-dant, punc-tu-a-tion...',
@@ -523,7 +514,6 @@ public function testHyphenateText()
523514
public function testMinWordLength()
524515
{
525516
$this->object->setHyphen('-');
526-
$this->object->setLanguage('en-us');
527517

528518
$this->assertEquals(
529519
'I am the same thing en-core in-stead im-poster ven-er-a-ble',
@@ -573,7 +563,6 @@ public function testMinWordLength()
573563
public function testHyphenateHtml()
574564
{
575565
$this->object->setHyphen('-');
576-
$this->object->setLanguage('en-us');
577566

578567
$this->assertEquals('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">'
579568
."\n".'<html><body><p>Ridicu-lous-ly <b class="unsplittable">com-pli-cat-ed</b> meta-text</p></body></html>'
@@ -590,7 +579,6 @@ public function testHyphenateHtml()
590579
public function testCaseInsensitivity()
591580
{
592581
$this->object->setHyphen('-');
593-
$this->object->setLanguage('en-us');
594582

595583
$this->assertEquals(['IN', 'EX', 'PLIC', 'A', 'BLE'], $this->object->splitText('INEXPLICABLE'));
596584
$this->assertEquals(['in', 'ex', 'plic', 'a', 'ble'], $this->object->splitText('inexplicable'));
@@ -601,7 +589,6 @@ public function testCaseInsensitivity()
601589
*/
602590
public function testHistogramText()
603591
{
604-
$this->object->setLanguage('en-us');
605592
$this->assertSame([], $this->object->histogramText('.'));
606593
$this->assertSame(
607594
[1 => 1, 2 => 2, 3 => 1, 5 => 1, 7 => 1],
@@ -614,7 +601,6 @@ public function testHistogramText()
614601
*/
615602
public function testCountWordsText()
616603
{
617-
$this->object->setLanguage('en-us');
618604
$this->assertSame(0, $this->object->countWordsText('.'));
619605
$this->assertSame(
620606
6,
@@ -627,7 +613,6 @@ public function testCountWordsText()
627613
*/
628614
public function testCountPolysyllablesText()
629615
{
630-
$this->object->setLanguage('en-us');
631616
$this->assertSame(0, $this->object->countPolysyllablesText('.'));
632617
$this->assertSame(
633618
3,
@@ -640,7 +625,6 @@ public function testCountPolysyllablesText()
640625
*/
641626
public function testCountSyllablesText()
642627
{
643-
$this->object->setLanguage('en-us');
644628
$this->assertSame(0, $this->object->countSyllablesText('.'));
645629
$this->assertSame(
646630
1 + 2 + 2 + 3 + 5 + 7,
@@ -653,7 +637,6 @@ public function testCountSyllablesText()
653637
*/
654638
public function testExcludeElement()
655639
{
656-
$this->object->setLanguage('en-us');
657640
$this->object->setHyphen('-');
658641
$this->object->excludeElement('b');
659642

@@ -671,7 +654,6 @@ public function testExcludeElement()
671654
*/
672655
public function testExcludeElements()
673656
{
674-
$this->object->setLanguage('en-us');
675657
$this->object->setHyphen('-');
676658
$this->object->excludeElement(['b', 'i']);
677659

@@ -689,7 +671,6 @@ public function testExcludeElements()
689671
*/
690672
public function testExcludeAllAndInclude()
691673
{
692-
$this->object->setLanguage('en-us');
693674
$this->object->setHyphen('-');
694675
$this->object->excludeAll();
695676
$this->object->includeElement('b');
@@ -708,7 +689,6 @@ public function testExcludeAllAndInclude()
708689
*/
709690
public function testExcludeAndInclude()
710691
{
711-
$this->object->setLanguage('en-us');
712692
$this->object->setHyphen('-');
713693
$this->object->excludeElement('b');
714694
$this->object->includeElement('i');
@@ -727,7 +707,6 @@ public function testExcludeAndInclude()
727707
*/
728708
public function testExcludeAttribute()
729709
{
730-
$this->object->setLanguage('en-us');
731710
$this->object->setHyphen('-');
732711
$this->object->excludeAttribute('class');
733712

@@ -745,7 +724,6 @@ public function testExcludeAttribute()
745724
*/
746725
public function testExcludeAttributeValue()
747726
{
748-
$this->object->setLanguage('en-us');
749727
$this->object->setHyphen('-');
750728
$this->object->excludeAttribute('class', 'unsplittable');
751729

0 commit comments

Comments
 (0)