src/Ripple.php
public function embed(?string $url = null, ?string $id = null): ?string
    {
        $hasMultiple = function (string $url, string $pattern): bool {
            return false !== strpos($url, $pattern);
        };

        if (isset($url, $id)) {
            $ripple = new static($url);

            if (null !== $ripple->provider) {
                $class = static::PROVIDERS[$provider = $ripple->provider];
                $embed = $class::embed($id, $hasMultiple($url, $class::MULTIPLE_PATTERN));
            }
        }

        if ('' !== $this->content) {
            $class = static::PROVIDERS[$provider = $this->provider];
            $embed = $class::embed($class::id($this->content), $hasMultiple($this->url, $class::MULTIPLE_PATTERN));
        }

        if (!isset($embed, $provider)) {
            return null;
        }

        if (isset($this->embedParams[$provider])) {
            return $embed.$this->embedParams[$provider];
        }

        return $embed;
    }
public function embed(?string $url = null, ?string $id = null): ?string
    {
        $hasMultiple = function (string $url, string $pattern): bool {
            return false !== strpos($url, $pattern);
        };

        if (isset($url, $id)) {
            $ripple = new static($url);

            if (null !== $ripple->provider) {
                $class = static::PROVIDERS[$provider = $ripple->provider];
                $embed = $class::embed($id, $hasMultiple($url, $class::MULTIPLE_PATTERN));
            }
        }

        if ('' !== $this->content) {
            $class = static::PROVIDERS[$provider = $this->provider];
            $embed = $class::embed($class::id($this->content), $hasMultiple($this->url, $class::MULTIPLE_PATTERN));
        }

        if (!isset($embed, $provider)) {
            return null;
        }

        if (isset($this->embedParams[$provider])) {
            return $embed.$this->embedParams[$provider];
        }

        return $embed;
    }
public function embed ( ? string $ url = null , ? string $ id = null ) : ? string { $ hasMultiple = function ( string $ url , string $ pattern ) : bool { return false !== strpos ( $ url , $ pattern ) ; } ; if ( isset ( $ url , $ id ) ) { $ ripple = new static ( $ url ) ; if ( null !== $ ripple -> provider ) { $ class = static :: PROVIDERS [ $ provider = $ ripple -> provider ] ; $ embed = $ class :: embed ( $ id , $ hasMultiple ( $ url , $ class :: MULTIPLE_PATTERN ) ) ; } } if ( '' !== $ this -> content ) { $ class = static :: PROVIDERS [ $ provider = $ this -> provider ] ; $ embed = $ class :: embed ( $ class :: id ( $ this -> content ) , $ hasMultiple ( $ this -> url , $ class :: MULTIPLE_PATTERN ) ) ; } if ( ! isset ( $ embed , $ provider ) ) { return null ; } if ( isset ( $ this -> embedParams [ $ provider ] ) ) { return $ embed . $ this -> embedParams [ $ provider ] ; } return $ embed ; }
Returns HTML embed of the track.

@param null|string $url
@param null|string $id
@return null|string
Returns HTML embed of the track .