public function toArray()
    {
        if ($this->getMaxItems() != 1) {
            return parent::toArray();
        }

        if (!array_key_exists(0, $this->items)) {
            return null;
        }

        return $this->get(0)->toArray();
    }
public function toArray()
    {
        if ($this->getMaxItems() != 1) {
            return parent::toArray();
        }

        if (!array_key_exists(0, $this->items)) {
            return null;
        }

        return $this->get(0)->toArray();
    }
public function toArray ( ) { if ( $ this -> getMaxItems ( ) != 1 ) { return parent :: toArray ( ) ; } if ( ! array_key_exists ( 0 , $ this -> items ) ) { return null ; } return $ this -> get ( 0 ) -> toArray ( ) ; }
As we use a field collection even if we have only one value, we use it that way.

@return array|mixed|null
As we use a field collection even if we have only one value we use it that way .