Example #1
0
 /**
  * Let's do this ...
  * @param $template string The path or url to a tasty cheesecake template
  * @param $params array Optional parameters that are merged with existing
  *                      params from a cheesecake.json file :O
  * @param $options array Options
  */
 public function __construct($template, array $params = [], array $options = [])
 {
     $this->template = $template;
     $this->templateType = $this->detectTemplateType($template);
     $this->params = $params;
     $this->output = $this->getoa($options, self::OPT_OUTPUT, '.');
     $this->noInteraction = $this->getoa($options, self::OPT_NO_INTERACTION, false);
     $options = ['pragmas' => [\Mustache_Engine::PRAGMA_FILTERS]];
     $this->mustache = new \Mustache_Engine($options);
     $this->mustache->addHelper('string', ['toLowerCase' => function ($value) {
         return Stringy::toLowerCase($value);
     }, 'toUpperCase' => function ($value) {
         return Stringy::toUpperCase($value);
     }, 'upperCaseFirst' => function ($value) {
         return Stringy::upperCaseFirst($value);
     }, 'lowerCaseFirst' => function ($value) {
         return Stringy::lowerCaseFirst($value);
     }, 'humanize' => function ($value) {
         return Stringy::humanize($value);
     }, 'camelize' => function ($value) {
         return Stringy::camelize($value);
     }, 'upperCamelize' => function ($value) {
         return Stringy::upperCamelize($value);
     }, 'slugify' => function ($value) {
         return Stringy::slugify($value);
     }]);
     $this->fs = new Filesystem();
 }
Example #2
0
 /**
  * @dataProvider lowerCaseFirstProvider()
  */
 public function testLowerCaseFirst($expected, $str, $encoding = null)
 {
     $result = S::lowerCaseFirst($str, $encoding);
     $this->assertInternalType('string', $result);
     $this->assertEquals($expected, $result);
 }
Example #3
0
 public function lowerCaseFirst($string)
 {
     return Stringy::lowerCaseFirst($string);
 }