コード例 #1
0
ファイル: Restful.php プロジェクト: anahkiasen/cerberus
 /**
  * Display all items
  */
 public function getIndex()
 {
     $items = $this->object->all();
     $variable = String::plural($this->model);
     $variable = String::lower($variable);
     return View::make($this->page . '.index')->with($variable, $items);
 }
コード例 #2
0
ファイル: CollectionMethods.php プロジェクト: aleguisf/fvdev1
 /**
  * Check if an array has a given key
  */
 public static function has($array, $key)
 {
     // Generate unique string to use as marker
     $unfound = StringMethods::random(5);
     return static::get($array, $key, $unfound) !== $unfound;
 }
コード例 #3
0
ファイル: Repository.php プロジェクト: Geekathon/reddit-clone
 /**
  * Tries to find the right class to call
  *
  * @param string $callingClass The original class
  * @param string $method       The method
  * @param array  $arguments    The arguments
  *
  * @return string The correct class
  */
 protected static function computeClassToCall($callingClass, $method, $arguments)
 {
     if (!StringMethods::find($callingClass, 'Underscore\\Types')) {
         if (isset($arguments[0])) {
             $callingClass = Dispatch::toClass($arguments[0]);
         } else {
             $callingClass = Method::findInClasses($callingClass, $method);
         }
     }
     return $callingClass;
 }
コード例 #4
0
ファイル: Thumbnail.php プロジェクト: dyon/flatstrapper
 /**
  * Add a plain image
  *
  * @param string $image
  */
 protected function addPlainImage($image)
 {
     $image = $this->present($image);
     // Else just assume we were given an image path
     if (!String::contains($image, '<img')) {
         $image = HtmlImage::create($image);
     }
     return $this->nest(Element::create('li', $image)->addClass('thumbnail'));
 }
コード例 #5
0
ファイル: Link.php プロジェクト: memeq1/menu
 /**
  * Whether the link is special or not
  *
  * @return boolean
  */
 public function isSpecialUrl()
 {
     foreach ($this->hidden as $hidden) {
         if (StringMethods::startsWith($this->href, $hidden)) {
             return true;
         }
     }
     return false;
 }
コード例 #6
0
ファイル: HTML.php プロジェクト: anahkiasen/cerberus
 /**
  * Some shortcuts
  */
 public function __call($method, $parameters)
 {
     // Resource verbs
     if (String::endsWith($method, 'Resource')) {
         $verb = String::remove($method, 'Resource');
         $parameters = Arrays::prepend($parameters, $verb);
         return call_user_func_array(array($this, 'resource'), $parameters);
     }
     return parent::__call($method, $parameters);
 }