Code Duplication    Length = 5-6 lines in 3 locations

src/NSA.php 3 locations

@@ 114-119 (lines=6) @@
111
        $methodName = array_shift($arguments);
112
113
        Assert::string($methodName, 'Method name has to be a string. Variable of type "%s" was given.');
114
        if (is_string($objectOrClass)) {
115
            Assert::classExists($objectOrClass, 'Could not find class "%s"');
116
        } else {
117
            Assert::notInstanceOf($objectOrClass, '\stdClass', 'Can not get a method of \stdClass.');
118
            Assert::object($objectOrClass, 'Can not get a property of a non object. Variable of type "%s" was given.');
119
        }
120
121
        $refl = new \ReflectionClass($objectOrClass);
122
        if (!$refl->hasMethod($methodName)) {
@@ 211-215 (lines=5) @@
208
        Assert::string($propertyName, 'Property name must be a string. Variable of type "%s" was given.');
209
210
        $class = $objectOrClass;
211
        if (!is_string($objectOrClass)) {
212
            Assert::object($objectOrClass, 'Can not get a property of a non object. Variable of type "%s" was given.');
213
            Assert::notInstanceOf($objectOrClass, '\stdClass', 'Can not get a property of \stdClass.');
214
            $class = get_class($objectOrClass);
215
        }
216
217
        if (null === $refl = static::getReflectionClassWithProperty($class, $propertyName)) {
218
            throw new \LogicException(sprintf('The property %s does not exist on %s or any of its parents.', $propertyName, $class));
@@ 243-247 (lines=5) @@
240
    public static function getProperties($objectOrClass)
241
    {
242
        $class = $objectOrClass;
243
        if (!is_string($objectOrClass)) {
244
            Assert::object($objectOrClass, 'Can not get a property of a non object. Variable of type "%s" was given.');
245
            Assert::notInstanceOf($objectOrClass, '\stdClass', 'Can not get a property of \stdClass.');
246
            $class = get_class($objectOrClass);
247
        }
248
249
        $refl = new \ReflectionClass($class);
250
        $properties = $refl->getProperties();