Documentation

Cls

Helper for working with classes and objects

Tags
author

Jason Napolitano

version
1.0.0
since
1.0.0
license

MIT https://mit-license.org

Table of Contents

equals()  : bool
Are two classes the same as one another?
exists()  : bool
Wrapper for class_exists()
extends()  : bool
Wrapper for is_subclass_of()
getNamespace()  : string
Returns only a classes namespace name
implements()  : bool
Does a class implement an interface?
stripNamespace()  : string
Strip the namespace from a FQCN
throwable()  : bool
Check to see if a class implements the \Throwable interface

Methods

equals()

Are two classes the same as one another?

public static equals(string $classOne, string $classTwo) : bool
Parameters
$classOne : string
$classTwo : string
Return values
bool

exists()

Wrapper for class_exists()

public static exists(string $class) : bool
Parameters
$class : string
Tags
see
class_exists
Return values
bool

extends()

Wrapper for is_subclass_of()

public static extends(string $class, string $parent) : bool
Parameters
$class : string
$parent : string
Tags
see
is_subclass_of
Return values
bool

getNamespace()

Returns only a classes namespace name

public static getNamespace(string $classname) : string
Parameters
$classname : string
Tags
throws
ReflectionException
Return values
string

implements()

Does a class implement an interface?

public static implements(string $class, string $interface) : bool
Parameters
$class : string
$interface : string
Tags
throws
ReflectionException
Return values
bool

stripNamespace()

Strip the namespace from a FQCN

public static stripNamespace(string $classname) : string
Parameters
$classname : string
Tags
throws
ReflectionException
Return values
string

throwable()

Check to see if a class implements the \Throwable interface

public static throwable(string $exception) : bool
Parameters
$exception : string
Tags
throws
ReflectionException
Return values
bool

Search results