Code Duplication    Length = 7-8 lines in 2 locations

src/Controller/Component/CartComponent.php 2 locations

@@ 86-93 (lines=8) @@
83
    public function edit(\Cart\Entity\EntityPriceAwareInterface $entity, $quantity = 1)
84
    {
85
        $this->_validate($entity, $quantity);
86
        foreach ($this->_objects as &$object) {
87
            if ($object['entity'] == $entity) {
88
                $object['quantity'] = $quantity;
89
                $this->storage()->write($this->_objects);
90
91
                return true;
92
            }
93
        }
94
95
        throw new \Exception();
96
    }
@@ 105-111 (lines=7) @@
102
     */
103
    public function delete(\Cart\Entity\EntityPriceAwareInterface $entity)
104
    {
105
        foreach ($this->_objects as $key => $object) {
106
            if ($object['entity'] == $entity) {
107
                unset ($this->_objects[$key]);
108
                $this->storage()->write($this->_objects);
109
                return true;
110
            }
111
        }
112
113
114
        throw new \Exception();