Stock/Cache/StockUnitCache.php
private function findBySubjectAndStates(StockSubjectInterface $subject, array $states = [])
    {
        $units = [];

        // Find by subject oid
        $oid = spl_object_hash($subject);
        if (isset($this->addedUnits[$oid])) {
            $units = $this->addedUnits[$oid];
        }

        // Filter by states
        if (!empty($units) && !empty($states)) {
            $units = array_filter($units, function (StockUnitInterface $unit) use ($states) {
                return in_array($unit->getState(), $states);
            });
        }

        return $units;
    }
private function findBySubjectAndStates(StockSubjectInterface $subject, array $states = [])
    {
        $units = [];

        // Find by subject oid
        $oid = spl_object_hash($subject);
        if (isset($this->addedUnits[$oid])) {
            $units = $this->addedUnits[$oid];
        }

        // Filter by states
        if (!empty($units) && !empty($states)) {
            $units = array_filter($units, function (StockUnitInterface $unit) use ($states) {
                return in_array($unit->getState(), $states);
            });
        }

        return $units;
    }
private function findBySubjectAndStates ( StockSubjectInterface $ subject , array $ states = [ ] ) { $ units = [ ] ; // Find by subject oid $ oid = spl_object_hash ( $ subject ) ; if ( isset ( $ this -> addedUnits [ $ oid ] ) ) { $ units = $ this -> addedUnits [ $ oid ] ; } // Filter by states if ( ! empty ( $ units ) && ! empty ( $ states ) ) { $ units = array_filter ( $ units , function ( StockUnitInterface $ unit ) use ( $ states ) { return in_array ( $ unit -> getState ( ) , $ states ) ; } ) ; } return $ units ; }
Finds the suck units by subject and states.

@param StockSubjectInterface $subject
@param array                 $states

@return array|StockUnitInterface[]
Finds the suck units by subject and states .