/**
  * Creates object from $parsedResponse.
  * 
  * @param array $parsedResponse XML response parsed into array.
  * 
  * @return WindowsAzure\Common\Models\Logging
  */
 public static function create($parsedResponse)
 {
     $result = new self();
     $result->setVersion($parsedResponse['Version']);
     $result->setDelete(Utilities::toBoolean($parsedResponse['Delete']));
     $result->setRead(Utilities::toBoolean($parsedResponse['Read']));
     $result->setWrite(Utilities::toBoolean($parsedResponse['Write']));
     $result->setRetentionPolicy(RetentionPolicy::create($parsedResponse['RetentionPolicy']));
     return $result;
 }
 /**
  * Creates object from $parsedResponse.
  * 
  * @param array $parsedResponse XML response parsed into array.
  * 
  * @return WindowsAzure\Common\Models\Metrics
  */
 public static function create($parsedResponse)
 {
     $result = new self();
     $result->setVersion($parsedResponse['Version']);
     $result->setEnabled(Utilities::toBoolean($parsedResponse['Enabled']));
     if ($result->getEnabled()) {
         $result->setIncludeAPIs(Utilities::toBoolean($parsedResponse['IncludeAPIs']));
     }
     $result->setRetentionPolicy(RetentionPolicy::create($parsedResponse['RetentionPolicy']));
     return $result;
 }
Example #3
0
 public static function byPath($_pathfile)
 {
     if (!file_exists($_pathfile)) {
         throw new Exception('Chemin jusqu\'au widget non trouvé : ' . $_pathfile);
     }
     $path_parts = pathinfo($_pathfile);
     $informations = explode('.', $path_parts['basename']);
     $widget = new self();
     $widget->setType($informations[1]);
     $widget->setSubtype($informations[2]);
     $widget->setName($informations[3]);
     $folder = explode('/', $path_parts['dirname']);
     $widget->setVersion($folder[count($folder) - 1]);
     $widget->setContent(file_get_contents($_pathfile));
     $widget->setPath($_pathfile);
     return $widget;
 }
Example #4
0
 public static function construct($_arrayMarket)
 {
     $market = new self();
     if (!isset($_arrayMarket['id'])) {
         return;
     }
     $market->setId($_arrayMarket['id']);
     $market->setName($_arrayMarket['name']);
     $market->setType($_arrayMarket['type']);
     $market->datetime = json_encode($_arrayMarket['datetime'], JSON_UNESCAPED_UNICODE);
     $market->setDescription($_arrayMarket['description']);
     $market->setDownloaded($_arrayMarket['downloaded']);
     $market->setUser_id($_arrayMarket['user_id']);
     $market->setVersion($_arrayMarket['version']);
     $market->setCategorie($_arrayMarket['categorie']);
     $market->status = json_encode($_arrayMarket['status'], JSON_UNESCAPED_UNICODE);
     $market->setAuthor($_arrayMarket['author']);
     $market->setChangelog($_arrayMarket['changelog']);
     $market->setLogicalId($_arrayMarket['logicalId']);
     $market->setUtilization($_arrayMarket['utilization']);
     $market->setCertification($_arrayMarket['certification']);
     $market->setPurchase($_arrayMarket['purchase']);
     $market->setCost($_arrayMarket['cost']);
     $market->rating = $_arrayMarket['rating'];
     $market->setBuyer($_arrayMarket['buyer']);
     $market->setUpdateBy($_arrayMarket['updateBy']);
     $market->setPrivate($_arrayMarket['private']);
     $market->img = json_encode($_arrayMarket['img'], JSON_UNESCAPED_UNICODE);
     $market->link = json_encode($_arrayMarket['link'], JSON_UNESCAPED_UNICODE);
     $market->language = json_encode($_arrayMarket['language'], JSON_UNESCAPED_UNICODE);
     if (isset($_arrayMarket['hardwareCompatibility'])) {
         $market->hardwareCompatibility = json_encode($_arrayMarket['hardwareCompatibility'], JSON_UNESCAPED_UNICODE);
     }
     $market->change = '';
     $market->setRealcost($_arrayMarket['realCost']);
     if (!isset($_arrayMarket['isAuthor'])) {
         $_arrayMarket['isAuthor'] = true;
     }
     $market->setIsAuthor($_arrayMarket['isAuthor']);
     return $market;
 }
Example #5
0
 /**
  * Generate a new Cookie object from a cookie string
  * (for example the value of the Set-Cookie HTTP header)
  *
  * @static
  * @throws Zend_Http_Header_Exception_InvalidArgumentException
  * @param  $headerLine
  * @param  bool $bypassHeaderFieldName
  * @return array|SetCookie
  */
 public static function fromString($headerLine, $bypassHeaderFieldName = false)
 {
     list($name, $value) = explode(': ', $headerLine, 2);
     // check to ensure proper header type for this factory
     if (strtolower($name) !== 'set-cookie') {
         throw new Zend_Http_Header_Exception_InvalidArgumentException('Invalid header line for Set-Cookie string: "' . $name . '"');
     }
     $multipleHeaders = preg_split('#(?<!Sun|Mon|Tue|Wed|Thu|Fri|Sat),\\s*#', $value);
     $headers = array();
     foreach ($multipleHeaders as $headerLine) {
         $header = new self();
         $keyValuePairs = preg_split('#;\\s*#', $headerLine);
         foreach ($keyValuePairs as $keyValue) {
             if (strpos($keyValue, '=')) {
                 list($headerKey, $headerValue) = preg_split('#=\\s*#', $keyValue, 2);
             } else {
                 $headerKey = $keyValue;
                 $headerValue = null;
             }
             // First K=V pair is always the cookie name and value
             if ($header->getName() === NULL) {
                 $header->setName($headerKey);
                 $header->setValue($headerValue);
                 continue;
             }
             // Process the remanining elements
             switch (str_replace(array('-', '_'), '', strtolower($headerKey))) {
                 case 'expires':
                     $header->setExpires($headerValue);
                     break;
                 case 'domain':
                     $header->setDomain($headerValue);
                     break;
                 case 'path':
                     $header->setPath($headerValue);
                     break;
                 case 'secure':
                     $header->setSecure(true);
                     break;
                 case 'httponly':
                     $header->setHttponly(true);
                     break;
                 case 'version':
                     $header->setVersion((int) $headerValue);
                     break;
                 case 'maxage':
                     $header->setMaxAge((int) $headerValue);
                     break;
                 default:
                     // Intentionally omitted
             }
         }
         $headers[] = $header;
     }
     return count($headers) == 1 ? array_pop($headers) : $headers;
 }
Example #6
0
 /**
  * Creates and configure a empty manager instance via array options
  * @param array $config
  * @return \PHPLegends\Assets\Manager
  */
 public static function createEmptyFromConfig(array $config)
 {
     $manager = new self();
     if (isset($config['base_uri'])) {
         $manager->setBaseUri($config['base_uri']);
     }
     if (isset($config['path'])) {
         $manager->setBasePath($config['path']);
     }
     if (isset($config['path_aliases']) && is_array($config['path_aliases'])) {
         foreach ($config['path_aliases'] as $alias => $path) {
             $manager->addPathAlias($alias, $path);
         }
     }
     if (isset($config['compiled'])) {
         $manager->setCompileDirectory($config['compiled']);
     }
     if (isset($config['version'])) {
         $manager->setVersion($config['version']);
     }
     return $manager;
 }
 /**
  * {@inheritdoc}
  */
 public static function fromArray(array $values)
 {
     $message = new self();
     $values = array_merge(['asset_id' => null, 'bundle_name' => null, 'version' => null, 'checksum' => null, 'size' => null, 'key' => null], $values);
     $message->setAssetId($values['asset_id']);
     $message->setBundleName($values['bundle_name']);
     $message->setVersion($values['version']);
     $message->setChecksum($values['checksum']);
     $message->setSize($values['size']);
     $message->setKey($values['key']);
     return $message;
 }
Example #8
0
 private static function _getObject(Resultset $rs, Project_Build $build)
 {
     $ret = new self($build);
     $ret->setDate($rs->getDate());
     $ret->setVersion($rs->getVersion());
     $ret->resetSignature();
     return $ret;
 }
Example #9
0
 private static function _getObject(Resultset $rs, Project_Build $build)
 {
     $ret = new self($build);
     $ret->setDate($rs->getDate());
     $ret->setVersion($rs->getVersion());
     $ret->setAhh($rs->getAhh());
     $ret->setAndc($rs->getAndc());
     $ret->setCalls($rs->getCalls());
     $ret->setCcn($rs->getCcn());
     $ret->setCcn2($rs->getCcn2());
     $ret->setCloc($rs->getCloc());
     $ret->setClsa($rs->getClsa());
     $ret->setClsc($rs->getClsc());
     $ret->setEloc($rs->getEloc());
     $ret->setFanout($rs->getFanout());
     $ret->setLeafs($rs->getLeafs());
     $ret->setLloc($rs->getLloc());
     $ret->setLoc($rs->getLoc());
     $ret->setMaxDit($rs->getMaxDit());
     $ret->setNcloc($rs->getNcloc());
     $ret->setNoc($rs->getNoc());
     $ret->setNof($rs->getNof());
     $ret->setNoi($rs->getNoi());
     $ret->setNom($rs->getNom());
     $ret->setNop($rs->getNop());
     $ret->setRoots($rs->getRoots());
     $ret->resetSignature();
     return $ret;
 }
Example #10
0
 /**
  * Factory method for <i>HttpRequest</i> creation from server
  *
  * This method uses superglobal array <code>$_SERVER</code> to build single
  * Request-Line consisting of <i>METHOD</i>, <i>URI</i> and <i>PROTOCOL</i>.
  * Headers and content is created via functions <code>getallheaders()</code>
  * and <code>file_get_contents()</code>.
  *
  * @return HttpRequest request object
  */
 public static function createFromServer()
 {
     $request = new self();
     $request->setMethod($_SERVER['REQUEST_METHOD']);
     $request->setUri($_SERVER['REQUEST_URI']);
     $request->setVersion($_SERVER['SERVER_PROTOCOL']);
     $request->setHeaders(getallheaders());
     $request->setContent(file_get_contents('php://input'));
     return $request;
 }