Parse the given visibility value.

@param  string|null $visibility
@return string|null

@throws \InvalidArgumentException
180692
protected function parseVisibility( $visibility )
	{
		if ( is_null( $visibility ) )
			return null;

		switch ( $visibility )
		{
			case FilesystemContract::VISIBILITY_PUBLIC:
				return AdapterInterface::VISIBILITY_PUBLIC;
			case FilesystemContract::VISIBILITY_PRIVATE:
				return AdapterInterface::VISIBILITY_PRIVATE;
		}

		throw new InvalidArgumentException( 'Unknown visibility: ' . $visibility );
	}
637188
public function setVisibility(string $path, string $visibility): bool
    {
        $path = $this->normalizePath($path);
        $this->assertPresent($path);

        return $this->getAdapter()->setVisibility($path, $visibility);
    }
1003273
public static function parse($source) {
        $name = null;
        $value = null;

        if (preg_match_all('@(<\S*?'.'>)@', $source, $matches)) {
            $name = $matches[0][0];
        }
        if (preg_match_all('@\[default: (.*)\]@i', $source, $matches)) {
            $value = $matches[0][1];
        }
        return new static($name, $value);
    }
318471
final public static function parseValue($searchValue, bool $looseComparison = false): string
    {
        if (false !== $name = \array_search($searchValue, self::getClassConstants(static::class), !$looseComparison)) {
            return $name;
        }

        throw new \InvalidArgumentException('Unknown enumeration value: ' . $searchValue);
    }
321902
public function filter($value)
    {
        $isInternalAllowed = $this->builder->isVisibilityAllowed(Settings::VISIBILITY_INTERNAL);
        if ($isInternalAllowed) {
            $value->setDescription(preg_replace('/\{@internal\s(.+?)\}\}/', '$1', $value->getDescription()));

            return $value;
        }

        // remove inline @internal tags
        $value->setDescription(preg_replace('/\{@internal\s(.+?)\}\}/', '', $value->getDescription()));

        // if internal elements are not allowed; filter this element
        if ($value->getTags()->get('internal')) {
            return null;
        }

        return $value;
    }
402519
public function setVisibility(string $visibility) {
		if ($visibility !== self::VISIBILITY_PRIVATE
				&& $visibility !== self::VISIBILITY_PROTECTED
				&& $visibility !== self::VISIBILITY_PUBLIC) {
			throw new \InvalidArgumentException(sprintf('The visibility "%s" does not exist.', $visibility));
		}

		$this->visibility = $visibility;

		return $this;
	}
1247004
public function filter($value)
    {
        if ($value instanceof VisibilityInterface
            && !$this->builder->isVisibilityAllowed($value->getVisibility())
        ) {
            return null;
        }

        return $value;
    }
1314605
function setHideServer($visibility, $multicall = false)
    {
        if (!is_int($visibility) || $visibility < 0 || $visibility > 2) {
            throw new InvalidArgumentException('visibility = ' . print_r($visibility, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array($visibility), $multicall);
    }
989657
public function getFields($visibility = Field::VISIBILITY_PUBLIC)
    {
        $ret = [];
        foreach ($this->fields as $name => $field) {
            if ($field->getVisibility() & $visibility) {
                $ret[$name] = $field;
            }
        }
        return $ret;
    }
392718
protected static function getVisibility(\Reflector $reflector): string
    {
        if (
            !$reflector instanceof \ReflectionMethod &&
            !$reflector instanceof \ReflectionProperty
        ) {
            throw new InvalidArgumentException(
                sprintf(
                    'Reflector must be an instance of "%s" or "%s", "%s" given',
                    \ReflectionMethod::class,
                    \ReflectionProperty::class,
                    \get_class($reflector)
                )
            );
        }

        foreach (['Public', 'Protected', 'Private'] as $visibility) {
            if ($reflector->{'is' . $visibility}()) {
                return strtolower($visibility);
            }
        }

        throw new \RuntimeException('Witness me!');
    }
1167931
private function parseKey($key)
    {
        if (!$key) {
            throw new InvalidArgumentException('string', 0, 'Cannot be null');
        }

        if (!is_string($key)) {
            throw new InvalidArgumentException('string', 0);
        }

        $arr = array(
            'prefix' => null,
        );

        $arr['identifier'] = $key;

        $pattern = '#^--|^-|^/#';
        if (preg_match($pattern, $key, $matches)) {
            $arr['prefix'] = $matches[0];
        }
        $arr['key'] = preg_replace($pattern, '', $key);

        return $arr;
    }
949911
public function update_visibility($visible = null) {
        if (is_bool($visible)) {
            $this->_visible = $visible;
        } else {
            $this->_visible = !$this->_visible;
        }
        return $this->update_visible();
    }
1240821
function resolve($presence) {
        if($presence instanceof \CharlotteDunois\Yasmin\Models\Presence) {
            return $presence;
        }
        
        if($presence instanceof \CharlotteDunois\Yasmin\Models\User) {
            $presence = $presence->id;
        }
        
        if(\is_int($presence)) {
            $presence = (string) $presence;
        }
        
        if(\is_string($presence) && parent::has($presence)) {
            return parent::get($presence);
        }
        
        throw new \InvalidArgumentException('Unable to resolve unknown presence');
    }
96508
public static function isValid($visibility)
    {
        switch ($visibility) {
            case Visibility::TYPE_PRIVATE:
            case Visibility::TYPE_PROTECTED:
            case Visibility::TYPE_PUBLIC:
                return true;
        }
        throw new \InvalidArgumentException('The ' . $visibility . ' is not allowed');
    }
1025829
private function parseName($event)
    {
        if ($event instanceof EventEnvelopeInterface) {
            return $event->getEventName();
        }

        if (is_object($event)) {
            $class = get_class($event);
        } elseif (is_string($event)) {
            $class = $event;
        } else {
            throw new \InvalidArgumentException(sprintf('Cannot parse name for type %s', gettype($event)));
        }

        if (substr($class, -5) === 'Event') {
            $class = substr($class, 0, -5);
        }

        $parts = explode('\\', $class);

        return end($parts);
    }
65196
public function find($view)
    {
        /** @var ViewFinderInterface $viewFinder */
        foreach ($this->viewFinders as $viewFinder) {
            try {
                return $viewFinder->find($view);
            } catch (\Exception $e) {
            }
        }

        throw new InvalidArgumentException("View [$view] not found in any registered viewfinder.");
    }
736822
public function checkVisibility($visibility, $name, $original)
    {
        if (\in_array('public', $visibility) && \in_array('protected', $visibility)) {
            throw new CompilerException("Property '$name' cannot be 'public' and 'protected' at the same time", $original);
        }
        if (\in_array('public', $visibility) && \in_array('private', $visibility)) {
            throw new CompilerException("Property '$name' cannot be 'public' and 'private' at the same time", $original);
        }
        if (\in_array('private', $visibility) && \in_array('protected', $visibility)) {
            throw new CompilerException("Property '$name' cannot be 'protected' and 'private' at the same time", $original);
        }
    }