Code Duplication    Length = 7-8 lines in 2 locations

src/Controller/Component/CartComponent.php 2 locations

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