예제 #1
0
 /**
  * @param int $providerId
  * @return ProviderInfo[]
  * @throws \Exception
  */
 public function get($providerId = null)
 {
     MDataType::mustBe(array(MDataType::INT));
     $toReturn = array();
     $sql = "CALL mt_provider_get(?);";
     $query = new MPDOQuery($sql, $this->connection);
     $query->bindValue($providerId);
     $queryResult = $query->exec();
     if ($queryResult == false || $query->getResult()->rowCount() <= 0) {
         return $toReturn;
     }
     foreach ($query->getResult() as $row) {
         $userLogins = new ProviderInfo();
         $userLogins->setName($row['name'])->setAppKey($row['app_key'])->setSecretKey($row['secret_key'])->setId((int) $row['id']);
         $toReturn[] = $userLogins;
     }
     return $toReturn;
 }
예제 #2
0
 /**
  * @param string $path
  * @return void
  */
 private function removeFolder($path)
 {
     MDataType::mustBe(MDataType::STRING);
     if (!file_exists($path)) {
         return;
     }
     if (!is_dir($path)) {
         unlink($path);
     }
     foreach (scandir($path) as $item) {
         if ($item == '.' || $item == '..') {
             continue;
         }
         $this->removeFolder($path . DIRECTORY_SEPARATOR . $item);
     }
     rmdir($path);
 }
 /**
  * @param string $tableName
  * @return MMySQLCacheManager
  */
 private function setTableName($tableName)
 {
     MDataType::mustBe(MDataType::STRING);
     $this->tableName = $tableName;
     return $this;
 }
예제 #4
0
파일: MHash.php 프로젝트: mpstyle/mtoolkit
 /**
  * @param string $text
  * @return string
  */
 public function getHash($text)
 {
     MDataType::mustBe(array(MDataType::STRING));
     return hash($this->hashAlgorithm, $text);
 }
예제 #5
0
파일: MMap.php 프로젝트: mpstyle/mtoolkit
 /**
  * Removes the item with the key <i>$key</i> from the map and returns the value associated with it.
  * 
  * @param mixed $key
  * @return mixed
  * @throws MWrongTypeException
  */
 public function take($key)
 {
     MDataType::mustBe(array(MDataType::STRING));
     $key = $this->getValue($key);
     $this->remove($key);
     return $key;
 }
예제 #6
0
 /**
  * @param int $ttl
  * @return MCacheItem
  */
 public function setTtl($ttl)
 {
     MDataType::mustBe(MDataType::INT);
     $this->ttl = $ttl;
     return $this;
 }
예제 #7
0
 /**
  * @param int $pageSize
  * @return Pagination
  */
 public function setPageSize($pageSize)
 {
     MDataType::mustBe(MDataType::INT);
     $this->pageSize = $pageSize;
     return $this;
 }
예제 #8
0
 /**
  * @param string $name
  * @return Provider
  */
 public function setName($name)
 {
     MDataType::mustBe(array(MDataType::STRING));
     $this->name = $name;
     return $this;
 }
예제 #9
0
 /**
  * @param boolean $enabled
  * @return User
  */
 public function setEnabled($enabled)
 {
     MDataType::mustBe(array(MDataType::BOOLEAN));
     $this->enabled = $enabled;
     return $this;
 }
예제 #10
0
 public function offsetGet_string($offset)
 {
     MDataType::mustBe(MDataType::STRING);
     if ($this->offsetExists_string($offset)) {
         return $this->record[$offset];
     }
     return null;
 }
예제 #11
0
 /**
  * @param int $offset
  */
 public function offsetUnset($offset)
 {
     MDataType::mustBe(array(MDataType::INT));
     if ($this->offsetExists($offset)) {
         unset($this->vector[$offset]);
     }
 }
예제 #12
0
 /**
  * Constructs a time with hour <i>$h</i>, minute <i>$m</i>, seconds <i>$s</i> and milliseconds <i>ms</i>.
  *
  * @param int $h
  * @param int $m
  * @param int $s
  * @param int $ms
  */
 public function __construct($h = 0, $m = 0, $s = 0, $ms = 0)
 {
     MDataType::mustBe(array(MDataType::INT, MDataType::INT, MDataType::INT, MDataType::INT));
     $this->setHMS($h, $m, $s, $ms);
 }
예제 #13
0
 /**
  * @param string $output
  * @return MHttpResponse
  */
 public function appendOutput($output)
 {
     MDataType::mustBe(array(MDataType::STRING));
     $this->output .= $output;
     return $this;
 }
예제 #14
0
 /**
  * @param int $start
  * @param int $end
  * @return \MToolkit\Core\MList
  */
 public function slice($start, $end)
 {
     MDataType::mustBe(array(MDataType::INT, MDataType::INT));
     $list = array_slice($this->list, $start, $end);
     return new MList($list);
 }