public function create($subjectOrName)
    {
        // Check if container or name is defined
        if (
            !$subjectOrName instanceof ContentSubjectInterface &&
            !(is_string($subjectOrName) && 0 < strlen($subjectOrName))
        ) {
            throw new InvalidOperationException("Excepted instance of ContentSubjectInterface or string.");
        }

        // New instance
        $content = $this->editor->getRepository()->createContent();

        // Create default container
        $this->editor->getContainerManager()->create($content);

        // Add to container if available
        if ($subjectOrName instanceof ContentSubjectInterface) {
            $subjectOrName->setContent($content);
        } else {
            $content->setName($subjectOrName);
        }

        return $content;
    }
public function create($subjectOrName)
    {
        // Check if container or name is defined
        if (
            !$subjectOrName instanceof ContentSubjectInterface &&
            !(is_string($subjectOrName) && 0 < strlen($subjectOrName))
        ) {
            throw new InvalidOperationException("Excepted instance of ContentSubjectInterface or string.");
        }

        // New instance
        $content = $this->editor->getRepository()->createContent();

        // Create default container
        $this->editor->getContainerManager()->create($content);

        // Add to container if available
        if ($subjectOrName instanceof ContentSubjectInterface) {
            $subjectOrName->setContent($content);
        } else {
            $content->setName($subjectOrName);
        }

        return $content;
    }
public function create ( $ subjectOrName ) { // Check if container or name is defined if ( ! $ subjectOrName instanceof ContentSubjectInterface && ! ( is_string ( $ subjectOrName ) && 0 < strlen ( $ subjectOrName ) ) ) { throw new InvalidOperationException ( "Excepted instance of ContentSubjectInterface or string." ) ; } // New instance $ content = $ this -> editor -> getRepository ( ) -> createContent ( ) ; // Create default container $ this -> editor -> getContainerManager ( ) -> create ( $ content ) ; // Add to container if available if ( $ subjectOrName instanceof ContentSubjectInterface ) { $ subjectOrName -> setContent ( $ content ) ; } else { $ content -> setName ( $ subjectOrName ) ; } return $ content ; }
Creates a new content.

@param ContentSubjectInterface|string $subjectOrName

@return ContentInterface
@throws InvalidOperationException
Creates a new content .