Exemplo n.º 1
0
 public function doPost(JsonResponse $response, HttpPost $post)
 {
     $song_id = $post->get("song_id")->reject("")->get();
     $metadata = $post->get("metadata")->filter("is_array")->get();
     $result = count($metadata) == 0 ? array() : Songs::edit($song_id, $metadata);
     $response->write(["tracks" => $result]);
 }
Exemplo n.º 2
0
 public function __construct()
 {
     $this->sources = new Sequence();
     $this->sources->push(http\HttpGet::getInstance());
     $this->sources->push(http\HttpPut::getInstance());
     $this->sources->push(http\HttpPost::getInstance());
     $this->sources->push(router\RouteArgs::getInstance());
 }
Exemplo n.º 3
0
 function __construct()
 {
     $post = HttpPost::getInstance();
     /** @var \ReflectionProperty $property */
     foreach ((new \ReflectionClass($this))->getProperties() as $property) {
         if ($property->isStatic() || substr($property->getName(), 0, 1) == "_") {
             continue;
         }
         $property->setAccessible(true);
         $property->setValue($this, $post->get($property->getName()));
     }
     $this->validate();
 }