Overview

Namespaces

  • SpanishGuestReportGenerator
    • Util

Classes

  • SpanishGuestReportGenerator\AbstractFactory
  • SpanishGuestReportGenerator\Guest
  • SpanishGuestReportGenerator\GuestFactory
  • SpanishGuestReportGenerator\GuestReport
  • SpanishGuestReportGenerator\Hotel
  • SpanishGuestReportGenerator\HotelFactory
  • SpanishGuestReportGenerator\Util\Helper

Traits

  • SpanishGuestReportGenerator\FormatterTrait
  • SpanishGuestReportGenerator\SanitizerTrait

Exceptions

  • SpanishGuestReportGenerator\FactoryException
  • SpanishGuestReportGenerator\GuestReportException
  • Overview
  • Namespace
  • Class
 1:  2:  3:  4:  5:  6:  7:  8:  9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 
<?php
/**
 * Spanish Guest Report Generator
 *
 * @package    Spanish Guest Report Generator
 * @author     Javier Zapata <javierzapata82@gmail.com>
 * @copyright  2021 Javier Zapata <javierzapata82@gmail.com>
 * @license    https://opensource.org/licenses/MIT  The MIT License
 * @link       https://github.com/bahiazul/spanish-guest-report-generator
 */

namespace SpanishGuestReportGenerator\Util;

/**
 * Static helpers
 *
 * @package    Spanish Guest Report Generator
 * @author     Javier Zapata <javierzapata82@gmail.com>
 * @copyright  2021 Javier Zapata <javierzapata82@gmail.com>
 * @license    https://opensource.org/licenses/MIT  The MIT License
 * @link       https://github.com/bahiazul/spanish-guest-report-generator
 */
class Helper
{
    /**
     * Finds whether an array is associative
     *
     * @param  array   $array The array being evaluated.
     * @return boolean
     */
    final public static function is_assoc_array(array $array)
    {
        if ($array === []) return false;

        return array_keys($array) !== range(0, count($array) - 1);
    }

    /**
     * Converts any value into a string without raising Errors, Notices or
     * getting weird results (like "Array")
     *
     * @param  mixed $value
     * @return string
     */
    final public static function stringify($value)
    {
        if (is_array($value) || (is_object($value) && !method_exists($value, '__toString'))) {
            $value = '';
        } elseif (!is_string($value)) {
            $value = strval($value);
        }

        return $value;
    }
}
API documentation generated by ApiGen