Esempio n. 1
0
 /**
  * Yields a singleton instance of Inflections so you can specify additional
  * inflector rules.
  *
  * Example:
  *   Inflector::inflections(function($inflect){
  *     $inflect->uncountable("rails");
  *   });
  *
  * @param callable $block
  * @return Inflections
  * @author Koen Punt
  */
 public static function inflections($block = false)
 {
     if ($block) {
         return call_user_func($block, Inflections::instance());
     } else {
         return Inflections::instance();
     }
 }
Esempio n. 2
0
 /**
  * @covers PhpInflector\Inflector\Inflections::clear
  */
 public function testClear()
 {
     $this->assertEmpty($this->object->plurals);
     $this->assertEmpty($this->object->singulars);
     $this->assertEmpty($this->object->uncountables);
     $this->assertEmpty($this->object->humans);
     $this->object->human("legacy_col_person_name", "Name");
     $this->object->irregular('cow', 'kine');
     $this->assertNotEmpty($this->object->plurals);
     $this->assertNotEmpty($this->object->singulars);
     $this->assertNotEmpty($this->object->humans);
     $this->object->clear();
     $this->assertEmpty($this->object->plurals);
     $this->assertEmpty($this->object->singulars);
     $this->assertEmpty($this->object->uncountables);
     $this->assertEmpty($this->object->humans);
     $this->object->uncountable('information');
     $this->assertNotEmpty($this->object->uncountables);
     $this->object->clear('uncountables');
     $this->assertEmpty($this->object->uncountables);
 }