<?php
declare(strict_types=1);

namespace WP_AUX\Services;

class AdminService
{
  public static function isPostTypeEditor(string $type): bool
  {
    global $pagenow;

    return (
      ( $pagenow === 'post-new.php' && $type === @$_GET['post_type'] ) ||
      ( $pagenow === 'post.php' && get_post_type(@$_GET['post']) === $type )
    );
  }

  public static function isTaxonomyEditor(string $taxonomy): bool
  {
    global $pagenow;

    return (
      ( $pagenow === 'edit-tags.php' && @$_GET['taxonomy'] === $taxonomy ) ||
      ( $pagenow === 'term.php' && @$_GET['taxonomy'] === $taxonomy )
    );
  }
}
