Create a new post type instance.

@param string $slug
@param string $plural
@param string $singular

@throws PostTypeException

@return PostTypeInterface
498007
public function make(string $slug, string $plural, string $singular): PostTypeInterface
    {
        $postType = (new PostType($slug, $this->action, $this->filter))
            ->setLabels([
                'name' => $plural,
                'singular_name' => $singular,
                'add_new_item' => sprintf('Add New %s', $singular),
                'edit_item' => sprintf('Edit %s', $singular),
                'new_item' => sprintf('New %s', $singular),
                'view_item' => sprintf('View %s', $singular),
                'view_items' => sprintf('View %s', $plural),
                'search_items' => sprintf('Search %s', $plural),
                'not_found' => sprintf('No %s found', $plural),
                'not_found_in_trash' => sprintf('No %s found in Trash', $plural),
                'parent_item_colon' => sprintf('Parent %s:', $singular),
                'all_items' => sprintf('All %s', $plural),
                'archives' => sprintf('%s Archives', $singular),
                'attributes' => sprintf('%s Attributes', $singular),
                'insert_into_item' => sprintf('Insert into %s', strtolower($singular)),
                'uploaded_to_this_item' => sprintf('Uploaded to this %s', strtolower($singular)),
                'filter_items_list' => sprintf('Filter %s list', strtolower($plural)),
                'items_list_navigation' => sprintf('%s list navigation', $plural),
                'items_list' => sprintf('%s list', $plural)
            ])
            ->setArguments([
                'public' => true,
                'show_in_rest' => true,
                'menu_position' => 20,
                'supports' => ['title'],
                'has_archive' => true
            ]);

        $abstract = sprintf('themosis.posttype.%s', $slug);

        if (! $this->container->bound($abstract)) {
            $this->container->instance($abstract, $postType);
        } else {
            throw new PostTypeException('The post type ['.$slug.'] already exists.');
        }

        return $postType;
    }
1245963
public function slug($slug = null): self
    {
        if (! empty($slug)) {
            // set this slug to be used in with callback
            $this->slug = $slug;

            // exception to filter on specific slug
            $exception = function ($query) {
                $query->where('slug', '=', $this->slug);
            };

            // load term to filter
            return $this->whereHas('term', $exception);
        }

        return $this;
    }
194400
public static function create($route, array $parameters, $message, $type = self::DEFAULT_FLASH_KEY, $statusCode = self::DEFAULT_STATUS_CODE)
    {
        return new static($route, $parameters, array($type => array($message)), $statusCode);
    }
156178
public static function createVirtualColumnsForSlug(string $postTypeSlug, $languageSlugs = [])
    {
        $languageSlugs = ($languageSlugs && !is_array($languageSlugs) ? explode(" ", $languageSlugs): $languageSlugs);
        $languageSlugs = ($languageSlugs ? $languageSlugs : Language::all()->pluck(['slug'])->toArray());

        $virtualColumns = [];
        foreach ($languageSlugs as $languageSlug){
            $virtualColumns[] = [
              "name" => $languageSlug,
              "type" => "string",
              "index" => true,
              "length" => 200,
            ];
        }
        AccioQuery::createVirtualColumns($postTypeSlug, "slug", $virtualColumns);
    }
288495
public static function register( $slug, $object, $parent = null ) {

		$caller = get_called_class();
		// get the current instance
		if ( empty( $object['type'] ) || ! uix()->is_callable( 'control\\' . $object['type'] ) ) {
			$object['type'] = 'text';
		}

		$caller = $caller . '\\' . $object['type'];

		return new $caller( $slug, $object, $parent );

	}
239664
public function toPlural(Pluralizer $pluralizer = null) {
		$pluralizer = $pluralizer ?: new EnglishPluralizer();

		return new Text($pluralizer->getPluralForm($this->string), $this->encoding);
	}
418321
public function singular() {
		if ( is_front_page() ) {
			return;
		}
		$this->addHierarchyOfSingularCrumbs( $this->_post );
		$this->addCrumb(
			get_the_title( $this->_post ),
			get_permalink( $this->_post )
		);
	}
435751
def register(type, plural = nil)
    type = type.to_sym

    if plural
      plural = plural.to_sym
    else
      plural = "#{type}s".to_sym
    end
    @plurals[plural] = type
    @types[type]     = Config.new
  end
536944
public static function create($name, $slug, $locale, $alias, $icon) : self
    {
        $self = new static();
        $self->name    = $name;
        $self->slug    = $slug;
        $self->locale  = $locale;
        $self->alias   = $alias;
        $self->icon    = $icon;
        $self->created_by = Yii::$app->user->identity->id;
        $self->updated_by = Yii::$app->user->identity->id;
        return $self;
    }
714658
public function edit($slug)
    {
        $this->loadModel('Content.ContentTypes');
        $this->loadModel('User.Roles');

        $type = $this->ContentTypes
            ->find()
            ->where(['slug' => $slug])
            ->first();

        if (!$type) {
            throw new NotFoundException(__d('content', 'Content type was not found!'));
        }

        if ($this->request->data()) {
            $type->accessible(['id', 'slug'], false);
            $data = $this->request->data();
            $type = $this->ContentTypes->patchEntity($type, $data);

            if ($this->ContentTypes->save($type, ['associated' => ['Roles']])) {
                $this->Flash->success(__d('content', 'Content type updated!'));
                $this->redirect(['plugin' => 'Content', 'controller' => 'types', 'action' => 'edit', $type->slug]);
            } else {
                $this->Flash->danger(__d('content', 'Content type could not be updated, check your information.'));
            }
        } else {
            // fix for auto-fill "defaults.*" by FormHelper
            $this->request->data = $type->toArray();
        }

        $roles = $this->Roles->find('list');
        $this->title(__d('content', 'Configure Content Type'));
        $this->set(compact('type', 'roles'));
        $this->set('languages', LocaleToolbox::languagesList());
        $this->Breadcrumb
            ->push('/admin/content/manage')
            ->push(__d('content', 'Content Types'), '/admin/content/types')
            ->push(__d('content', 'Editing "{0}" Content Type', $type->name), '');
    }
217604
private function composeApi(
        SettingsProviderInterface $settingsProvider,
        FileSystemInterface $fileSystem,
        string $singular,
        string $plural
    ): TemplateOutput {
        $folder = $settingsProvider->get(FluteSettingsInterface::class)[FluteSettingsInterface::KEY_API_FOLDER];

        $outputRootFolder = $this->filterOutFolderMask($folder);
        $outputFileName   = $plural . 'Api.php';
        $outputContent    = $this->composeTemplateContent(
            $fileSystem,
            $this->getTemplatePath('Api.txt'),
            [
                '{%SINGULAR_CC%}' => $singular,
                '{%PLURAL_CC%}'   => $plural,
                '{%SINGULAR_UC%}' => strtoupper($singular),
                '{%PLURAL_UC%}'   => strtoupper($plural),
            ]
        );

        return new TemplateOutput($outputRootFolder, $outputFileName, $outputContent);
    }
1074240
protected function buildPostTypeData($singular, $plural, $args)
    {
        $singular = ucwords($singular);
        $plural   = ucwords($plural);

        $labels = [
            'name'               => __($plural, LARAPRESS_TEXTDOMAIN),
            'singular_name'      => __($singular, LARAPRESS_TEXTDOMAIN),
            'add_new'            => __('Add New', LARAPRESS_TEXTDOMAIN),
            'add_new_item'       => __('Add New ' . $singular, LARAPRESS_TEXTDOMAIN),
            'edit_item'          => __('Edit ' . $singular, LARAPRESS_TEXTDOMAIN),
            'new_item'           => __('New ' . $singular, LARAPRESS_TEXTDOMAIN),
            'all_items'          => __('All ' . $plural, LARAPRESS_TEXTDOMAIN),
            'view_item'          => __('View ' . $singular, LARAPRESS_TEXTDOMAIN),
            'search_items'       => __('Search ' . $singular, LARAPRESS_TEXTDOMAIN),
            'not_found'          => __('No ' . strtolower($singular) . ' found', LARAPRESS_TEXTDOMAIN),
            'not_found_in_trash' => __('No ' . strtolower($singular) . ' found in trash', LARAPRESS_TEXTDOMAIN),
            'parent_item_colon'  => '',
            'menu_name'          => __($plural, LARAPRESS_TEXTDOMAIN)
        ];

        return array_merge(
            [
                'label'         => __($plural, LARAPRESS_TEXTDOMAIN),
                'labels'        => $labels,
                'description'   => '',
                'public'        => true,
                'menu_position' => 20,
                'has_archive'   => true
            ],
            $args
        );
    }
67827
public function loadFromSlug(string $slug) : BlogArticle
    {
        $categories = $this->blogArticleRepo->matching(
            $this->blogArticleRepo->criteria()
                ->where(BlogArticle::SLUG, '=', $slug)
                ->where(BlogArticle::PUBLISHED, '=', true)
        );

        if (!$categories) {
            throw new EntityNotFoundException(BlogArticle::class, $slug, BlogArticle::SLUG);
        }

        return reset($categories);
    }
1155907
public function sp($singular, $plural, $count, $autoTranslate = false) {
		if ((int)$count !== 1) {
			$result = $plural;
		} else {
			$result = $singular;
		}

		if ($autoTranslate) {
			$result = __($result);
		}
		return $result;
	}
823823
private function make($slug, array $arguments = [])
    {
        $thumbnail = $this->container->make(Thumbnail::class);

        $thumbnail
            ->setSlug($slug)
            ->setArguments($arguments)
            ->dispatch();

        return $this->hang($thumbnail);
    }
24545
public function inflectNounByNumber($number, $singular, $plural, $genitivePlural)
    {
        $units = $number % 10;
        $tens = ((int) ($number / 10)) % 10;

        if ($number === 1) {
            return $singular;
        }

        if ($tens === 1 && $units > 1) {
            return $genitivePlural;
        }

        if ($units >= 2 && $units <= 4) {
            return $plural;
        }

        return $genitivePlural;
    }
1236789
public static function addWord($singular, $plural, $verbal = null)
    {
        self::$_cache['pluralized'][$singular] = $plural;
        self::$_cache['singularized'][$plural] = $singular;
        
        self::$_cache['singularized'][$singular] = $singular;
        self::$_cache['pluralized'][$plural] = $plural;
        
        if (isset($verbal)) {
            self::$_cache['verbalized'][$singular] = $verbal;
            self::$_cache['verbalized'][$plura] = $verbal;
        }
    }