public function addLocation(
        $id,
        $name,
        $code,
        $type,
        LocationInterface $parent = null
    ) {
        $location = isset($this->locations[$id])
            ? $this->locations[$id]
            : $this
                ->locationFactory
                ->create()
                ->setId($id)
                ->setName($name)
                ->setCode($code)
                ->setType($type);

        if ($parent instanceof LocationInterface) {
            $location->addParent($parent);
        }

        $this->locations[$id] = $location;

        return $location;
    }
public function addLocation(
        $id,
        $name,
        $code,
        $type,
        LocationInterface $parent = null
    ) {
        $location = isset($this->locations[$id])
            ? $this->locations[$id]
            : $this
                ->locationFactory
                ->create()
                ->setId($id)
                ->setName($name)
                ->setCode($code)
                ->setType($type);

        if ($parent instanceof LocationInterface) {
            $location->addParent($parent);
        }

        $this->locations[$id] = $location;

        return $location;
    }
public function addLocation ( $ id , $ name , $ code , $ type , LocationInterface $ parent = null ) { $ location = isset ( $ this -> locations [ $ id ] ) ? $ this -> locations [ $ id ] : $ this -> locationFactory -> create ( ) -> setId ( $ id ) -> setName ( $ name ) -> setCode ( $ code ) -> setType ( $ type ) ; if ( $ parent instanceof LocationInterface ) { $ location -> addParent ( $ parent ) ; } $ this -> locations [ $ id ] = $ location ; return $ location ; }
Given a location information, create a new Location.

@param string                 $id     Location id
@param string                 $name   Location name
@param string                 $code   Location code
@param string                 $type   Location type
@param LocationInterface|null $parent Location parent

@return LocationInterface Location
Given a location information create a new Location .