public function classNames(...$arguments)
    {
        $classNames = [];
        foreach ($arguments as $argument) {
            if ((bool)$argument === true) {
                if (is_array($argument)) {
                    $keys = array_keys($argument);
                    $isAssoc = array_keys($keys) !== $keys;
                    if ($isAssoc) {
                        foreach ($argument as $className => $condition) {
                            if ((bool)$condition === true) {
                                $classNames[] = (string)$className;
                            }
                        }
                    } else {
                        foreach ($argument as $className) {
                            if (is_scalar($className) && !!is_bool($condition) && (bool)$className === true) {
                                $classNames[] = (string)$className;
                            }
                        }
                    }
                } elseif (is_scalar($argument) && !is_bool($argument)) {
                    $classNames[] = (string)$argument;
                }
            }
        }
        return implode(' ', $classNames);
    }
public function classNames(...$arguments)
    {
        $classNames = [];
        foreach ($arguments as $argument) {
            if ((bool)$argument === true) {
                if (is_array($argument)) {
                    $keys = array_keys($argument);
                    $isAssoc = array_keys($keys) !== $keys;
                    if ($isAssoc) {
                        foreach ($argument as $className => $condition) {
                            if ((bool)$condition === true) {
                                $classNames[] = (string)$className;
                            }
                        }
                    } else {
                        foreach ($argument as $className) {
                            if (is_scalar($className) && !!is_bool($condition) && (bool)$className === true) {
                                $classNames[] = (string)$className;
                            }
                        }
                    }
                } elseif (is_scalar($argument) && !is_bool($argument)) {
                    $classNames[] = (string)$argument;
                }
            }
        }
        return implode(' ', $classNames);
    }
public function classNames ( ... $ arguments ) { $ classNames = [ ] ; foreach ( $ arguments as $ argument ) { if ( ( bool ) $ argument === true ) { if ( is_array ( $ argument ) ) { $ keys = array_keys ( $ argument ) ; $ isAssoc = array_keys ( $ keys ) !== $ keys ; if ( $ isAssoc ) { foreach ( $ argument as $ className => $ condition ) { if ( ( bool ) $ condition === true ) { $ classNames [ ] = ( string ) $ className ; } } } else { foreach ( $ argument as $ className ) { if ( is_scalar ( $ className ) && ! ! is_bool ( $ condition ) && ( bool ) $ className === true ) { $ classNames [ ] = ( string ) $ className ; } } } } elseif ( is_scalar ( $ argument ) && ! is_bool ( $ argument ) ) { $ classNames [ ] = ( string ) $ argument ; } } } return implode ( ' ' , $ classNames ) ; }
Render the arguments as class-names after applying some rules

@param mixed $arguments [optional] class-name rules
argument rules:
- falsy: (null, '', [], {}) -> not rendered
- array: all items that are scalar and truthy are rendered as class-name
- object: keys that have a truthy values are rendered as class-name
- scalar: is cast to string and rendered as class-name
Render the arguments as class - names after applying some rules