<commit_before><?php
/************************************************************************
 * This file is part of 4373Alpha-Server Project.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 * ************************************************************************
 * Created at 13.03.15, 10:44 by 4nn3ck
 * ************************************************************************
 */

namespace Anneck\Game\Item;

use Anneck\Game\Exception\GameException;
use Anneck\Game\GameInterface;
use Anneck\Game\GameLogger;
use Anneck\Game\ItemInterface;

/**
 * The ItemFactory creates game items.
 *
 *
 * @since   0.0.1-dev
 *
 * @author  <NAME> <<EMAIL>>
 */
class ItemFactory
{
    /**
     * Static factory method to create items for a game.
     *
     * @param string        $itemIdentifier
     * @param string        $itemName
     * @param GameInterface $game
     *
     * @return ItemInterface
     *
     * @throws GameException
     */
    public static function createGameItem($itemIdentifier, $itemName = '', GameInterface $game)
    {
        if (is_null($game)) {
            throw new GameException('Failed to create item without game!');
        }
        $factory = new self();

        return $factory->createItem($itemIdentifier, $itemName, $game);
    }

    /**
     * Creates a new item for the game and returns it.
     *
     * @param string        $itemIdentifier the short class name of the item.
     * @param string        $itemName       the name to set for this item.
     * @param GameInterface $game           the game to use.
     *
     * @return ItemInterface the created item.
     *
     * @throws GameException if the GameInterface is null
     */<commit_msg>Fix Sonar-Critical<commit_after><?php
/************************************************************************
 * This file is part of 4373Alpha-Server Project.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 * ************************************************************************
 * Created at 13.03.15, 10:44 by 4nn3ck
 * ************************************************************************
 */

namespace Anneck\Game\Item;

use Anneck\Game\Exception\GameException;
use Anneck\Game\GameInterface;
use Anneck\Game\GameLogger;
use Anneck\Game\ItemInterface;

/**
 * The ItemFactory creates game items.
 *
 *
 * @since   0.0.1-dev
 *
 * @author  <NAME> <<EMAIL>>
 */
class ItemFactory
{
    /**
     * Static factory method to create items for a game.
     *
     * @param string        $itemIdentifier
     * @param string        $itemName
     * @param GameInterface $game
     *
     * @return ItemInterface
     *
     * @throws GameException
     */
    public static function createGameItem($itemIdentifier, $itemName = '', GameInterface $game = null)
    {
        if (is_null($game)) {
            throw new GameException('Failed to create item without game!');
        }
        $factory = new self();

        return $factory->createItem($itemIdentifier, $itemName, $game);
    }

    /**
     * Creates a new item for the game and returns it.
     *
     * @param string        $itemIdentifier the short class name of the item.
     * @param string        $itemName       the name to set for this item.
     * @param GameInterface $game           the game to use.
     *
     * @return ItemInterface the created item.
     *
     * @throws GameException if the GameInterface is null
     */
{'fraction_non_alphanumeric': 0.20784313725490197, 'fraction_numerical': 0.010644257703081233, 'mean_word_length': 2.827438370846731, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4722536', 'n_tokens_mistral': 949, 'n_tokens_neox': 896, 'n_words': 302}