Exemple #1
0
 /**
  * Returns the raw request data
  *
  * @return array
  */
 public static function raw()
 {
     if (!is_null(static::$raw)) {
         return static::$raw;
     }
     return static::$raw = array_merge($_GET, $_POST);
 }
 /**
  * Get Token Counts by App
  *
  * @return void
  * @author 
  **/
 public static function getAppTokenCounts()
 {
     $ins = new static();
     $result = $ins->raw(function ($collection) {
         return $collection->aggregate(['$group' => ['_id' => '$app_key', 'users' => ['$sum' => 1]]]);
     });
     usort($result['result'], function ($a, $b) {
         return $b['users'] - $a['users'];
     });
     return $result['result'];
 }
Exemple #3
0
 public function setUp()
 {
     parent::setUp();
     // Reset all menus
     Menu::reset();
     $this->refreshApplication();
     // Precreate somme Dummy data
     static::$link = new Link('#', 'foo');
     static::$raw = new Raw('foo');
     static::$itemList = new ItemList();
     static::$item = new Item(static::$itemList, static::$link);
 }
 /**
  * @inheritdoc
  */
 public static function begin($config = [])
 {
     static::$raw = true;
     parent::begin($config);
 }
 /**
  * loadRawFromRequest
  *
  * @return  string
  */
 protected function loadRawFromRequest()
 {
     if (static::$raw) {
         return static::$raw;
     }
     static::$raw = file_get_contents('php://input');
     // This is a workaround for where php://input has already been read.
     // See note under php://input on http://php.net/manual/en/wrappers.php.php
     if (empty($this->raw) && isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
         static::$raw = $GLOBALS['HTTP_RAW_POST_DATA'];
     }
     return static::$raw;
 }