PostType   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 36
c 1
b 0
f 0
dl 0
loc 62
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A get_labels() 0 54 1
1
<?php declare(strict_types = 1);
2
3
namespace WPSteak\Services\Labels;
4
5
/** @codeCoverageIgnore */
6
trait PostType {
7
8
	use Common;
9
10
	/**
11
	 * @param array<string> $defaults Defaults label.
12
	 * @return array<string>
13
	 */
14
	public function get_labels( string $singular, string $plural, int $is_female = 0, array $defaults = [] ): array {
15
		$singular_lower = strtolower( $singular );
16
		$plural_lower = strtolower( $plural );
17
18
		$labels = [
19
			'add_new' => _n( 'Adicionar nova', 'Adicionar novo', $is_female, 'wpsteak' ),
20
			/* translators: %s label singular female lower; %s label singular male lower; */
21
			'new_item' => sprintf( _n( 'Nova %s', 'Novo %s', $is_female, 'wpsteak' ), $singular_lower ),
22
			/* translators: %s label plural lower. */
23
			'view_items' => sprintf( __( 'Ver %s', 'wpsteak' ), $plural_lower ),
24
			'not_found_in_trash' => sprintf(
25
				/* translators: %s label singular lower. */
26
				_n( 'Nenhuma %s encontrada na Lixeira.', 'Nenhum %s encontrado na Lixeira.', $is_female, 'wpsteak' ),
27
				$singular_lower,
28
			),
29
			/* translators: %s label plural lower. */
30
			'archives' => sprintf( __( 'Arquivos de %s', 'wpsteak' ), $plural_lower ),
31
			/* translators: %s label plural lower. */
32
			'attributes' => sprintf( __( 'Atributos de %s', 'wpsteak' ), $plural_lower ),
33
			'insert_into_item' => sprintf(
34
				/* translators: %s label singular lower. */
35
				_n( 'Inserir na %s', 'Inserir no %s', $is_female, 'wpsteak' ),
36
				$singular_lower,
37
			),
38
			'uploaded_to_this_item' => sprintf(
39
				/* translators: %s label singular lower. */
40
				_n( 'Carregado para esta %s', 'Carregado para este %s', $is_female, 'wpsteak' ),
41
				$singular_lower,
42
			),
43
			'featured_image' => __( 'Imagem destacada', 'wpsteak' ),
44
			'set_featured_image' => __( 'Definir imagem destacada', 'wpsteak' ),
45
			'remove_featured_image' => __( 'Remover imagem destacada', 'wpsteak' ),
46
			'use_featured_image' => __( 'Usar como imagem destacada', 'wpsteak' ),
47
			/* translators: %s label plural lower. */
48
			'filter_items_list' => sprintf( __( 'Filtrar lista de %s', 'wpsteak' ), $plural_lower ),
49
			/* translators: %s label plural lower. */
50
			'items_list_navigation' => sprintf( __( 'Navegação da lista de %s', 'wpsteak' ), $plural_lower ),
51
			/* translators: %s label plural lower. */
52
			'items_list' => sprintf( __( 'Lista de %s', 'wpsteak' ), $plural_lower ),
53
			'name_admin_bar' => $singular,
54
		];
55
56
		$labels = array_merge(
57
			$labels,
58
			$this->get_defaults(
59
				$singular,
60
				$singular_lower,
61
				$plural,
62
				$plural_lower,
63
				$is_female,
64
			),
65
		);
66
67
		return array_merge( $labels, $defaults );
68
	}
69
70
}
71