/** * Extracts visibility * * @param ReflectedMethod $method * @param $n * @param TokenCollection $tokens * @return $this */ public function extractVisibility(ReflectedMethod $method, $n, TokenCollection $tokens) { switch (true) { case $this->searcher->isPrecededBy(T_PRIVATE, $n, $tokens, 4): $visibility = ReflectedMethod::VISIBILITY_PRIVATE; break; case $this->searcher->isPrecededBy(T_PROTECTED, $n, $tokens, 4): $visibility = ReflectedMethod::VISIBILITY_PROTECTED; break; case $this->searcher->isPrecededBy(T_PUBLIC, $n, $tokens, 4): default: $visibility = ReflectedMethod::VISIBILITY_PUBLIC; break; } $method->setVisibility($visibility); return $this; }