public function getContentTypeByName($name, $space, array $options = [])
    {
        $envelope = $this->findEnvelopeForSpace($space);
        $promise = coroutine(
            function () use ($name, $space, $envelope, $options) {
                $contentTypeFromEnvelope = $envelope->findContentTypeByName($name);
                if ($contentTypeFromEnvelope) {
                    yield promise_for($contentTypeFromEnvelope);
                    return;
                }
                $contentTypes = (yield $this->getContentTypes([], $space, array_merge($options, ['async' => true])));
                $foundContentType = null;
                foreach ($contentTypes as $contentType) {
                    if ($contentType->getName() === $name) {
                        $foundContentType = $contentType;
                    }
                    $envelope->insertContentType($contentType);
                }

                yield $foundContentType;
            }
        );

        return (isset($options['async']) && $options['async']) ? $promise : $promise->wait();
    }
public function getContentTypeByName($name, $space, array $options = [])
    {
        $envelope = $this->findEnvelopeForSpace($space);
        $promise = coroutine(
            function () use ($name, $space, $envelope, $options) {
                $contentTypeFromEnvelope = $envelope->findContentTypeByName($name);
                if ($contentTypeFromEnvelope) {
                    yield promise_for($contentTypeFromEnvelope);
                    return;
                }
                $contentTypes = (yield $this->getContentTypes([], $space, array_merge($options, ['async' => true])));
                $foundContentType = null;
                foreach ($contentTypes as $contentType) {
                    if ($contentType->getName() === $name) {
                        $foundContentType = $contentType;
                    }
                    $envelope->insertContentType($contentType);
                }

                yield $foundContentType;
            }
        );

        return (isset($options['async']) && $options['async']) ? $promise : $promise->wait();
    }
public function getContentTypeByName ( $ name , $ space , array $ options = [ ] ) { $ envelope = $ this -> findEnvelopeForSpace ( $ space ) ; $ promise = coroutine ( function ( ) use ( $ name , $ space , $ envelope , $ options ) { $ contentTypeFromEnvelope = $ envelope -> findContentTypeByName ( $ name ) ; if ( $ contentTypeFromEnvelope ) { yield promise_for ( $ contentTypeFromEnvelope ) ; return ; } $ contentTypes = ( yield $ this -> getContentTypes ( [ ] , $ space , array_merge ( $ options , [ 'async' => true ] ) ) ) ; $ foundContentType = null ; foreach ( $ contentTypes as $ contentType ) { if ( $ contentType -> getName ( ) === $ name ) { $ foundContentType = $ contentType ; } $ envelope -> insertContentType ( $ contentType ) ; } yield $ foundContentType ; } ) ; return ( isset ( $ options [ 'async' ] ) && $ options [ 'async' ] ) ? $ promise : $ promise -> wait ( ) ; }
Gets a content type using its name. Assumes content types have unique names. Returns null if no content type with the given name can be found.

@param string                $name
@param string|SpaceInterface $space
@param array                 $options
@return ContentTypeInterface|PromiseInterface|null
Gets a content type using its name . Assumes content types have unique names . Returns null if no content type with the given name can be found .