public function parse($resolution) {
    preg_match_all(self::RESOLUTION_FORMAT, $resolution, $matches);
    $message = "Cannot parse provided resolution '{$resolution}'. It must be in the following format: 360x640";
    Assert::notEmpty($matches, $message);
    Assert::keyExists($matches, 0, $message);
    Assert::keyExists($matches, 1, $message);
    Assert::keyExists($matches, 2, $message);
    Assert::notEmpty($matches[1][0], $message);
    Assert::notEmpty($matches[2][0], $message);
    $this->setWidth($matches[1][0]);
    $this->setHeight($matches[2][0]);
    return $this;
  }