Dump any PHP scalar value into INI syntax by special local static
configuration array.
@param mixed $value
@return string
189428
protected function dumpScalarValue ($value) {
		if (is_numeric($value)) {
			return (string) $value;
		} else if (is_bool($value)) {
			return $value ? 'true' : 'false';
		} else if ($value === NULL) {
			return 'null';
		} else {
			static $specialChars = [
				'=', '/', '.', '#', '&', '!', '?', '-', '@', "'", '"', '*', '^',
				'[', ']', '(', ')', '{', '}', '<', '>', '\n', '\r', 
			];
			$valueStr = (string) $value;
			$specialCharCaught = FALSE;
			foreach ($specialChars as $specialChar) {
				if (mb_strpos($valueStr, $specialChar)) {
					$specialCharCaught = TRUE;
					break;
				}
			}
			if ($specialCharCaught) {
				return '"' . addcslashes($valueStr, '"') . '"';
			} else {
				return $valueStr;
			}
		}
	}
1338137
public static function serializeValue($value)
    {
        if ($value instanceof JsonSerializable || $value instanceof \JsonSerializable) {
            return $value->jsonSerialize();
        }

        if (is_object($value)) {
            foreach (get_object_vars($value) as $nestedKey => $nestedValue) {
                $value->{$nestedKey} = self::serializeValue($nestedValue);
            }

            return $value;
        }

        if (is_array($value)) {
            foreach ($value as &$nestedValue) {
                $nestedValue = self::serializeValue($nestedValue);
            }

            return $value;
        }

        if ($value instanceof DateTime || $value instanceof \DateTimeInterface) {
            throw new DomainException('Please wrap your DateTime objects with Aplazame\Serializer\Date::fromDateTime');
        }

        if (is_float($value)) {
            throw new DomainException('Please wrap your float values with Aplazame\Serializer\Decimal::fromFloat');
        }

        return $value;
    }
187880
private function writeValue($value): string
    {
        if ('%%%%not_defined%%%%' === $value) {
            return '';
        }

        if (\is_string($value) || is_numeric($value)) {
            return $value;
        }

        if (false === $value) {
            return 'false';
        }

        if (true === $value) {
            return 'true';
        }

        if (null === $value) {
            return 'null';
        }

        if (empty($value)) {
            return '';
        }

        if (\is_array($value)) {
            return implode(',', $value);
        }
    }
872904
public function formatValue($value)
    {
        $formatter = $this->getValueFormatter();
        return (string)($formatter ? call_user_func($formatter, $value, $this->getGrid()->getCurrentRow()) : $value);
    }
45735
public function dump($value)
    {
        $dumper = $this->getDumper();

        if ($dumper) {
            // re-use the same DumpOutput instance, so it won't re-render the global styles/scripts on each dump.
            // exclude verbose information (e.g. exception stack traces)
            if (class_exists('Symfony\Component\VarDumper\Caster\Caster')) {
                $cloneVar = $this->getCloner()->cloneVar($value, Caster::EXCLUDE_VERBOSE);
                // Symfony VarDumper 2.6 Caster class dont exist.
            } else {
                $cloneVar = $this->getCloner()->cloneVar($value);
            }

            $dumper->dump(
                $cloneVar,
                $this->htmlDumperOutput
            );

            $output = $this->htmlDumperOutput->getOutput();
            $this->htmlDumperOutput->clear();

            return $output;
        }

        return htmlspecialchars(print_r($value, true));
    }
968837
public static function createSlug($value)
    {
        /*
         * Not a scalar value?
         * Nothing to do
         */
        if (!is_scalar($value)) {
            return false;
        }

        /*
         * It's an empty string?
         * Nothing to do
         */
        if ('' === $value) {
            return '';
        }

        $id = 'Latin-ASCII; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();';
        $transliterator = \Transliterator::create($id);

        $cleanValue = trim($value);
        $result = $transliterator->transliterate($cleanValue);

        return preg_replace('/[-\s]+/', '-', $result);
    }
536743
public static function VALUE($value = '')
    {
        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);

        if (!is_numeric($value)) {
            $numberValue = str_replace(
                PHPExcel_Shared_String::getThousandsSeparator(),
                '',
                trim($value, " \t\n\r\0\x0B" . PHPExcel_Shared_String::getCurrencyCode())
            );
            if (is_numeric($numberValue)) {
                return (float) $numberValue;
            }

            $dateSetting = PHPExcel_Calculation_Functions::getReturnDateType();
            PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);

            if (strpos($value, ':') !== false) {
                $timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($value);
                if ($timeValue !== PHPExcel_Calculation_Functions::VALUE()) {
                    PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
                    return $timeValue;
                }
            }
            $dateValue = PHPExcel_Calculation_DateTime::DATEVALUE($value);
            if ($dateValue !== PHPExcel_Calculation_Functions::VALUE()) {
                PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
                return $dateValue;
            }
            PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);

            return PHPExcel_Calculation_Functions::VALUE();
        }
        return (float) $value;
    }
827080
private function formatValue($value)
    {
        if ($value === '') {
            return '';
        }

        if ($value === null) {
            return '<comment>Null</comment>';
        }

        if (is_bool($value)) {
            return '<comment>' . ($value ? 'True' : 'False') . '</comment>';
        }

        if (empty($value)) {
            return '<comment>Empty</comment>';
        }

        if (is_array($value)) {
            return json_encode($value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
        }

        if (is_object($value)) {
            return sprintf('<%s>', get_class($value));
        }

        if (is_scalar($value)) {
            return $value;
        }

        throw new InvalidArgumentException(sprintf('Do not know how to format value "%s"', print_r($value, true)));
    }
438066
public function str($value)
    {
        if (is_array($value)) {
            $allScalar = function ($a, $b) {
                return $a && is_scalar($b);
            };
            if (!array_reduce($value, $allScalar, true)) {
                throw new UnexpectedValueException("Unexpected complex type " . Util::toPhp($value));
            }
            return join(' ', $value);
        }
        return (string)$value;
    }
1157138
public static function toString($value)
    {
        if($value == null)
        {
            return null;
        }
        $reflection = new \ReflectionClass(static::class);
        $values = $reflection->getConstants();

        //Check if input value is valid
        if(static::isValid($value, $reflection))
        {
            $constName = array_search($value, $values);
            return static::WordifyConst($constName);
        }
        else
        {
            return null;
        }
    }
586866
protected function output($value)
    {
        if ($value instanceof Renderable) {
            $value = $value->render();
        }

        if ($value instanceof Htmlable) {
            $value = $value->toHtml();
        }

        if ($value instanceof Jsonable) {
            $value = $value->toJson();
        }

        if (!is_null($value) && !is_scalar($value)) {
            return sprintf('<pre>%s</pre>', var_export($value, true));
        }

        return $value;
    }
29701
static private function stringify($value)
        {
            if (is_bool($value)) {
                return $value ? '<TRUE>' : '<FALSE>';
            }

            if (is_scalar($value)) {
                $val = (string) $value;

                if (strlen($val) > 100) {
                    $val = substr($val, 0, 97) . '...';
                }

                return $val;
            }

            if (Arrays::is($value)) {
                return '<ARRAY>';
            }

            if (is_object($value)) {
                return get_class($value);
            }

            if (is_resource($value)) {
                return '<RESOURCE>';
            }

            if ($value === null) {
                return '<NULL>';
            }

            return 'unknown';
        }
87917
private static function stringify($value)
    {
        if (is_string($value)) {
            return sprintf('"%s"', preg_replace('/\n/', '\n', $value));
        }

        if (is_bool($value)) {
            return $value ? 'true' : 'false';
        }

        if (is_null($value)) {
            return 'null';
        }

        if (is_array($value)) {
            return sprintf('[%s]', implode(', ', array_map(
                function ($value) {
                    return self::stringify($value);
                },
                $value
            )));
        }

        return (string) $value;
    }
1277804
public function dump($value) : string
    {
        if (! is_numeric($value))
            throw new DumpException($this, $value, self::ERROR);

        return ''. $value;
    }
1155524
public static function dump($value): string
    {
        try {
            return serialize($value);
        } catch (\Throwable $e) {
        }

        throw new DumpException(sprintf('Error serializing value. %s', $e->getMessage()), 0, $e);
    }
502662
public function serialize($value) : string
    {
        if (!is_int($value)) {
            throw InvalidValueException::valueDoesNotMatchType($this, $value);
        }

        return (string) $value;
    }
373490
public function esc(?string $value): string
    {
        if ($value === null) {
            return 'NULL';
        }

        $value = substr($this->pdo->quote($value), 1, -1);

        return $value;
    }