Code Duplication    Length = 22-23 lines in 2 locations

src/Discovery/Binding/LoadBindingDescriptor.php 1 location

@@ 64-85 (lines=22) @@
61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function execute()
65
    {
66
        // sanity check
67
        if ($this->bindingDescriptor->isLoaded()) {
68
            return;
69
        }
70
71
        $typeName = $this->bindingDescriptor->getTypeName();
72
        $typeDescriptor = $this->typeDescriptors->contains($typeName)
73
            ? $this->typeDescriptors->getFirst($typeName)
74
            : null;
75
76
        $this->bindingDescriptor->load($this->containingPackage, $typeDescriptor);
77
78
        $uuid = $this->bindingDescriptor->getUuid();
79
80
        if ($this->bindingDescriptors->contains($uuid)) {
81
            $this->previousDescriptor = $this->bindingDescriptors->get($uuid);
82
        }
83
84
        $this->bindingDescriptors->add($this->bindingDescriptor);
85
    }
86
87
    /**
88
     * {@inheritdoc}

src/Discovery/Type/UnloadTypeDescriptor.php 1 location

@@ 56-78 (lines=23) @@
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function execute()
57
    {
58
        // sanity check
59
        if (!$this->typeDescriptor->isLoaded()) {
60
            return;
61
        }
62
63
        // never fails with the check before
64
        $this->containingPackage = $this->typeDescriptor->getContainingPackage();
65
66
        $typeName = $this->typeDescriptor->getTypeName();
67
        $packageName = $this->containingPackage->getName();
68
69
        // never fails with the check before
70
        $this->typeDescriptor->unload();
71
72
        if ($this->typeDescriptors->contains($typeName, $packageName)
73
            && $this->typeDescriptor === $this->typeDescriptors->get($typeName, $packageName)) {
74
            // never fails
75
            $this->typeDescriptors->remove($typeName, $packageName);
76
            $this->wasRemoved = true;
77
        }
78
    }
79
80
    /**
81
     * {@inheritdoc}