todo: docs

@param Parser $parser

@endpoint ignore
@return array
480774
public function getDocJSON(Parser $parser) {
    $doc = parent::getDocJSON($parser);

    $rClass = new \ReflectionClass(get_called_class());

    foreach($doc['methods'] as $k => $methodDoc) {
      if($methodDoc['InternalMethodName'] == 'get') {
        $doc['methods'][$k]['MethodName'] = 'Get Full Collection';
      }
      elseif($methodDoc['InternalMethodName'] == 'post') {
        $doc['methods'][$k]['MethodName'] = 'Add to Collection';
      }
      elseif($methodDoc['InternalMethodName'] == 'put') {
        $doc['methods'][$k]['MethodName'] = 'Replace Full Collection';
      }
      elseif($methodDoc['InternalMethodName'] == 'delete') {
        $doc['methods'][$k]['MethodName'] = 'Delete Full Collection';
      }
    }

    $methodDoc = $this->getRestMethodDocJSON($parser, 'Get Resource',
      'GET', "/{$this->base}/:id", $rClass, '_restGetResource');
    if (!empty($methodDoc)) {
      $doc['methods'][] = $methodDoc;
    }
    $methodDoc = $this->getRestMethodDocJSON($parser, 'Update Resource',
      'PUT', "/{$this->base}/:id", $rClass, '_restPutResource');
    if (!empty($methodDoc)) {
      $doc['methods'][] = $methodDoc;
    }
    $methodDoc = $this->getRestMethodDocJSON($parser, 'Delete Resource',
      'DELETE', "/{$this->base}/:id", $rClass, '_restDeleteResource');
    if (!empty($methodDoc)) {
      $doc['methods'][] = $methodDoc;
    }

    // Add documentation for custom rest actions
    $rMethods = $rClass->getMethods(\ReflectionMethod::IS_PUBLIC);
    foreach ($rMethods as $rMethod) {
      $docComment = $rMethod->getDocComment();
      // If there is a '@endpoint ignore' property, the function is not served as an endpoint
      if (in_array('ignore', ReflectionHelper::getDocDirective($docComment, 'endpoint'))) {
        continue;
      }

      $methodDoc = array();

      $methodDoc['InternalMethodName'] = $rMethod->name;
      if (strpos($rMethod->name, 'restGet', 0) === 0) {
        $methodDoc['MethodName'] = substr($rMethod->name, 7);
        $methodDoc['HTTPMethod'] = 'GET';
      }
      elseif (strpos($rMethod->name, 'restPut', 0) === 0) {
        $methodDoc['MethodName'] = substr($rMethod->name, 7);
        $methodDoc['HTTPMethod'] = 'PUT';
      }
      elseif (strpos($rMethod->name, 'restPost', 0) === 0) {
        $methodDoc['MethodName'] = substr($rMethod->name, 8);
        $methodDoc['HTTPMethod'] = 'POST';
      }
      elseif (strpos($rMethod->name, 'restDelete', 0) === 0) {
        $methodDoc['MethodName'] = substr($rMethod->name, 10);
        $methodDoc['HTTPMethod'] = 'DELETE';
      }
      else {
        continue;
      }
      $action = strtolower($methodDoc['MethodName']);
      $methodDoc['URI'] = "/{$this->base}/:id/{$action}";
      $methodDoc['Synopsis'] = $parser->parse(ReflectionHelper::getDocText($docComment));
      $methodDoc['parameters'][] = array(
        'Name' => 'id',
        'Required' => 'Y',
        'Type' => 'string',
        'Location' => 'url',
        'Description' => 'The id of the resource'
      );
      $methodDoc['parameters'] = array_merge($methodDoc['parameters'], $this->getDocParameters($rMethod));

      // Allow controller middlewares to modify the documentation for this method
      if (!empty($this->middlewares)) {
        $middleware = reset($this->middlewares);
        $middleware->documentMethod($rClass, $rMethod, $methodDoc);
      }

      if (!empty($methodDoc)) {
        $doc['methods'][] = $methodDoc;
      }
    }

    return $doc;
  }
300270
public function parserOptions($parserName = null)
    {
        $this->fillIfNotFilled();
        if (!$parserName) {
            return $this->parserOptions;
        }
        if (isset($this->parserOptions[$parserName])) {
            return $this->parserOptions[$parserName];
        }

        return [];
    }
331577
public static function ParserFirstCallInit(&$parser){
    $parser->setFunctionHook('movetoskin', 'Skinny::moveToSkinPF');
    $parser->setFunctionHook('setskin', 'Skinny::setSkinPF');
    $parser->setFunctionHook('layout', 'Skinny::setLayoutPF');
    $parser->setFunctionHook('skinsert', 'Skinny::insertTemplatePF');
    $parser->setFunctionHook('imageurl', 'Skinny::getImageURLPF');

    return true;
  }
1256483
public static function parseMangaCard(Parser\Common\MangaCardParser $parser): MangaCard
    {
        $instance = new self();
        self::setProperties($parser, $instance);

        return $instance;
    }
1368490
public static function fromParser(AnimeStatsParser $parser): AnimeStats
    {
        $instance = new self();
        $instance->watching = $parser->getWatching();
        $instance->completed = $parser->getCompleted();
        $instance->onHold = $parser->getOnHold();
        $instance->dropped = $parser->getDropped();
        $instance->planToWatch = $parser->getPlanToWatch();
        $instance->total = $parser->getTotal();
        $instance->scores = $parser->getScores();

        return $instance;
    }
788
public function remove(TextParser $parser)
    {
        $parserHash = $this->objectHash($parser);

        $this->parsers = array_filter($this->parsers, function ($known) use ($parserHash) {
            return $this->objectHash($known) != $parserHash;
        });

        if (isset($this->parserIds[$parserHash])) {
            unset($this->parserIds[$parserHash]);
        }

        return $this;
    }
827757
public static function fromParser(MangaParser $parser): Manga
    {
        $instance = new self();

        $instance->title = $parser->getMangaTitle();
        $instance->url = $parser->getMangaURL();
        $instance->malId = $parser->getMangaId();
        $instance->imageUrl = $parser->getMangaImageURL();
        $instance->synopsis = $parser->getMangaSynopsis();
        $instance->titleEnglish = $parser->getMangaTitleEnglish();
        $instance->titleSynonyms = $parser->getMangaTitleSynonyms();
        $instance->titleJapanese = $parser->getMangaTitleJapanese();
        $instance->type = $parser->getMangaType();
        $instance->chapters = $parser->getMangaChapters();
        $instance->volumes = $parser->getMangaVolumes();
        $instance->status = $parser->getMangaStatus();
        $instance->publishing = $instance->status === 'Publishing';
        $instance->published = $parser->getPublished();
        $instance->genres = $parser->getMangaGenre();
        $instance->score = $parser->getMangaScore();
        $instance->scoredBy = $parser->getMangaScoredBy();
        $instance->rank = $parser->getMangaRank();
        $instance->popularity = $parser->getMangaPopularity();
        $instance->members = $parser->getMangaMembers();
        $instance->favorites = $parser->getMangaFavorites();
        $instance->related = $parser->getMangaRelated();
        $instance->background = $parser->getMangaBackground();
        $instance->authors = $parser->getMangaAuthors();
        $instance->serializations = $parser->getMangaSerialization();

        return $instance;
    }
304516
public function disableParser($parser)
    {
        if ($parser instanceof ValueParserInterface) {
            $parser = $parser->getName();
        }

        if (is_string($parser)) {
            $this->disabledParsers[] = $parser;
        }

        return $this;
    }
689217
public static function fromParser(FavoritesParser $parser): Favorites
    {
        $instance = new self();
        $instance->anime = $parser->getAnime();
        $instance->manga = $parser->getManga();
        $instance->characters = $parser->getCharacters();
        $instance->people = $parser->getPeople();

        return $instance;
    }
458103
public function prependParser(ValueParserInterface $parser)
    {
        $parsers = $this->parsers;
        if (array_key_exists($parser->getName(), $parsers)) {
            unset($parsers[$parser->getName()]);
        }

        $this->parsers = array_merge([$parser->getName() => $parser], $parsers);

        return $this;
    }
603025
public function parse($payload)
    {
        if ($payload) {
            $json = json_decode(trim($payload), true);
            if ( ! $json) {
                throw new ParserException('Failed To Parse JSON');
            }
            return $json;
        }

        return [];
    }
983273
public static function fromParser(AnimeGenreParser $parser): self
    {
        $instance = new self();
        $instance->itemCount = $parser->getCount();
        $instance->anime = $parser->getGenreAnime();
        $instance->malUrl = new MalUrl(
            $parser->getName(),
            $parser->getUrl()
        );

        return $instance;
    }
1241509
public static function fromParser(Parser\Search\AnimeSearchParser $parser): self
    {
        $instance = new self();

        $instance->results = $parser->getResults();
        $instance->lastPage = $parser->getLastPage();

        return $instance;
    }
731454
public function parseUrl($referer)
    {
        if (is_null($referer)) return null;

        $parsed = parse_url($referer);
        $parts  = explode('.', $parsed['host']);
        $domain = array_pop($parts);

        if (count($parts) > 0)
            $domain = array_pop($parts).'.'.$domain;

        return [
            'url'    => $referer,
            'domain' => $domain,
            'host'   => $parsed['host'],
        ];
    }
906601
public static function fromParser(ScheduleParser $parser): self
    {
        $instance = new self();
        $instance->monday = $parser->getShedule('monday');
        $instance->tuesday = $parser->getShedule('tuesday');
        $instance->wednesday = $parser->getShedule('wednesday');
        $instance->thursday = $parser->getShedule('thursday');
        $instance->friday = $parser->getShedule('friday');
        $instance->saturday = $parser->getShedule('saturday');
        $instance->sunday = $parser->getShedule('sunday');
        $instance->other = $parser->getShedule('other');
        $instance->unknown = $parser->getShedule('unknown');

        return $instance;
    }
307235
public function setParser(ParserInterface $parser)
    {
        $this->parsed = false;
        $this->parser = $parser;
        return $this;
    }
658923
public function append(PatternParser $parser) : self
    {
        $this->pattern .= $parser->getPattern();
        $this->fields = \array_merge($this->fields, $parser->getFields());

        return $this;
    }