Mistři v programování na #hovnokod

vsimnete si chybejiciho return ;)

	/**
	 * Gets account.
	 *
	 * @param int|Account $account
	 *
	 * @return Account|null
	 */
	private function getAccount($account)
	{
		if (is_object($account)) {
			return $account;
		}
		$this->accountRepository->findOneBy(['id' => $account]);
	}

Anonymous,

Trošku výživnější metoda :-) - $ids[] = $id; aneb pozdější iterace pole o jednom prvku - $helper neb recyklace proměnné :-)

    private function _messageAttachFlushedRedisServer(\Maknz\Slack\Message $message, string $id) {
        $helper = Mage::helper("aiti_notificator");
        if ($helper->isActive() && $this->_slack_notificator === NULL) {
            try {
                $this->_slack_notificator = $this->_createClient();
            } catch (Aiti_Notificator_Model_Exception_InvalidSettings $e) {
                Mage::getSingleton("adminhtml/session")->addWarning($helper->__("Cannot send Slack notification: %s", $e->getMessage()));
            }
        }

        $helper = Mage::helper('redismanager');
        $services = $helper->getServices();
        $ids[] = $id;
        foreach ($services as $service) {
            foreach ($ids as $value) {
                $message->attach([
                    'color' => Aiti_Notificator_Helper_Data::COLOR_YELLOW,
                        'title' => 'Server',
                        'text' => "Name: " . $services[$value]["name"] . " " . "- ID: " . $services[$value]["db"] . " " . "- IP: " . $services[$value]["host"] . ":" . $services[$value]["port"],
                        'short' => false
                    ]
                );
            }
        }
    }

Anonymous,

Podotýkám, že metoda isPaid jen čistě vrací úplně ten samý atribut. Je to tedy $this->paid && $this->paid

return $this->isPaid() && $this->paid;

Anonymous,


Anonymous,

Nebylo by vhodnější použít atribut deprecated?

	public function getVat()
	{
		throw new Base\LogicException('It can not get the object Vat, only value of Vat, use getVatValue().');
	}

Anonymous,