for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Abstract term.
*
* @package App
*/
declare(strict_types=1);
namespace App\Repositories;
use App\Services\Meta\TermInterface as MetaInterface;
* Abstract term class.
abstract class AbstractTerm {
* Meta.
* @var MetaInterface
protected $meta;
* Construct.
* @param MetaInterface $meta Meta.
public function __construct( MetaInterface $meta ) {
$this->meta = $meta;
}
* Get term.
* @param integer $id Id.
* @return \WP_term
* @throws \InvalidArgumentException When $id param is empty.
protected function get_term( int $id ) {
if ( empty( $id ) ) {
throw new \InvalidArgumentException( __( 'Termo vazio.', 'wpsteak' ) );
return get_term( $id );
return get_term($id)
WP_Error|array
WP_term
* Get terms.
* @param array $args Args.
* @return \WP_Term[]
* @throws \InvalidArgumentException When the passed taxonomy does not exists.
protected function get_terms( array $args ) : array {
$terms = get_terms( $args );
if ( is_wp_error( $terms ) ) {
throw new \InvalidArgumentException( __( 'Taxonomia não existe', 'wpsteak' ) );
return $terms;
return $terms
WP_Error
array