<?php

namespace Laravie\Authen;

use InvalidArgumentException;

class Authen
{
    /**
     * Identifier name.
     *
     * @var string
     */
    public static $identifier = 'identifier';

    /**
     * Get identifier name.
     *
     * @return string
     */
    public static function getIdentifierName(): string
    {
        return static::$identifier;
    }

    /**
     * Set identifier name.
     *
     * @param string $identifier
     *
     * @throws \InvalidArgumentException
     */
    public static function setIdentifierName(string $identifier): void
    {
        if (empty($identifier)) {
            throw new InvalidArgumentException("Identifier shouldn't be empty.");
        } elseif (\in_array($identifier, ['password'])) {
            throw new InvalidArgumentException("Identifier [{$identifier}] is not allowed!");
        }

        static::$identifier = $identifier;
    }
}

<?php

namespace Laravie\Authen;

use InvalidArgumentException;

class Authen
{
    /**
     * Identifier name.
     *
     * @var string
     */
    public static $identifier = 'identifier';

    /**
     * Get identifier name.
     *
     * @return string
     */
    public static function getIdentifierName(): string
    {
        return static::$identifier;
    }

    /**
     * Set identifier name.
     *
     * @param string $identifier
     *
     * @throws \InvalidArgumentException
     */
    public static function setIdentifierName(string $identifier): void
    {
        if (empty($identifier)) {
            throw new InvalidArgumentException("Identifier shouldn't be empty.");
        } elseif (in_array($identifier, ['password'])) {
            throw new InvalidArgumentException("Identifier [{$identifier}] is not allowed!");
        }

        static::$identifier = $identifier;
    }
}

--- 
+++ 
@@ -34,7 +34,7 @@
     {
         if (empty($identifier)) {
             throw new InvalidArgumentException("Identifier shouldn't be empty.");
-        } elseif (in_array($identifier, ['password'])) {
+        } elseif (\in_array($identifier, ['password'])) {
             throw new InvalidArgumentException("Identifier [{$identifier}] is not allowed!");
         }
 
Improve performance by prefixing all global functions calls with \ to
skip the look up and resolve process and go straight to the global
function

Signed-off-by: Mior Muhammad Zaki <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>
