Пример #1
0
 /**
  * Checks call to see if we can create a table from a magic call (for you wizards).
  * hover_striped, bordered_condensed, etc.
  *
  * @param string $method     Method name
  * @param array  $parameters Method parameters
  *
  * @return mixed
  */
 public static function __callStatic($method, $parameters)
 {
     // Opening a table
     if (str_contains($method, 'open') or $method == 'open') {
         $method = strtolower($method);
         $classes = explode('_', $method);
         $method = array_pop($classes);
         // Fallback to default type if defined
         if (sizeof($classes) == 0) {
             $classes = Helpers::getContainer('config')->get('bootstrapper::table.classes');
         }
         // Filter table classes
         $classes = array_intersect($classes, static::$classes);
         $attributes = Helpers::set_multi_class_attributes($method, $classes, $parameters, 0, 'table-');
         $attributes = array_get($attributes, 0);
         static::$table = new static($attributes);
         return static::$table->open();
     }
     // Set default function
     if (!$method) {
         $method = 'table';
     }
     // Use cases
     switch ($method) {
         case 'close':
             $close = static::table()->close();
             static::$table = null;
             return $close;
             break;
         default:
             return call_user_func_array(array(static::table(), $method), $parameters);
             break;
     }
 }
Пример #2
0
 public function testDefaultOpen()
 {
     $table = Table::open();
     $this->assertEquals('<table class="table-striped table-hover table">', $table);
 }