getContentSource

Learn how to read the source of the content.

This method gives you the source of the content.

Signature

This method has the following signature:

public function getContentSource(): ContentSource

This method returns the content source of the content.

Example

Here is a basic example of how to use this method:

<?phpuse Croct\Plug\Content\ContentSource;use Croct\Plug\Croct;use Croct\Plug\FetchOptions;
$croct = Croct::fromDotenv();$options = FetchOptions::defaults()->withSchema();$metadata = $croct->fetchContent('home-banner', $options)->getMetadata();$source = $metadata->getContentSource();
if ($source === ContentSource::EXPERIMENT) {    // The content came from a running experiment.}