public static function module($module) { $module = Inflector::pluralize($module); return new static($module); }
protected function _generateArray(Type $parameter) { $type = $parameter->getComplexType() ? 'ns:' : 'xsd:'; $typesComplex = new TypesComplex(); $typesComplex->setName('ArrayOf' . ucfirst($parameter->getName()))->setArrayType($type . $this->_getObjectName($parameter) . '[]')->setArrayTypeName(Inflector::singularize($parameter->getName())); if ($parameter->getComplexType()) { $typesComplex->setComplex($this->_generateObject($parameter->getComplexType())); } return $typesComplex; }
/** * Test resetting inflection rules. * * @return void */ public function testCustomRuleWithReset() { Inflector::reset(); $uninflected = array('atlas', 'lapis', 'onibus', 'pires', 'virus', '.*x'); $pluralIrregular = array('as' => 'ases'); Inflector::rules('singular', array('rules' => array('/^(.*)(a|e|o|u)is$/i' => '\\1\\2l'), 'uninflected' => $uninflected), true); Inflector::rules('plural', array('rules' => array('/^(.*)(a|e|o|u)l$/i' => '\\1\\2is'), 'uninflected' => $uninflected, 'irregular' => $pluralIrregular), true); $this->assertEquals(Inflector::pluralize('Alcool'), 'Alcoois'); $this->assertEquals(Inflector::pluralize('Atlas'), 'Atlas'); $this->assertEquals(Inflector::singularize('Alcoois'), 'Alcool'); $this->assertEquals(Inflector::singularize('Atlas'), 'Atlas'); }
private function prepareResourceControllerName() { $parts = explode('_', $this->controller); if (in_array($this->action, array('index', 'create'))) { $suffix = array_pop($parts); } else { $suffix = Inflector::singularize(array_pop($parts)); } $parts[] = $suffix; return implode('_', $parts); }
public static function createModule($moduleName) { $moduleName = ucfirst(Inflector::singularize($moduleName)); $moduleName = Strings::appendPrefix($moduleName, '\\SugarClient\\Module\\'); return new $moduleName(); }
private function classNameFromTableName() { $parts = explode('_', $this->tableName); $parts = $this->removeTablePrefix($parts); $parts[] = Inflector::singularize(array_pop($parts)); $parts = Arrays::map($parts, 'ucfirst'); return implode('', $parts); }
/** * @return string */ public function getNameForObject() { return Inflector::singularize(ucfirst($this->getSanitizedName())); }
public static function getModuleName() { $reflectionClass = new ReflectionClass(get_called_class()); return Inflector::pluralize($reflectionClass->getShortName()); }