private function compileHack($loader, $hackName)
    {
        $logger = $this->logger;

        return function ($class) use ($loader, $hackName, $logger) {
            if (call_user_func($loader, $class)) {
                $logger->debug(
                    'Custom class loader hack {hackName} loaded {class}.',
                    array(
                        'hackName' => $hackName,
                        'class'    => $class
                    )
                );

                return $hackName;
            }

            if (EnumeratingClassLoader::isLoaded($class)) {
                $logger->warning(
                    'Hack {hackName} appears to have loaded {class} but did return null. It SHOULD return true.',
                    array('hackName' => $hackName, 'class' => $class)
                );

                return $hackName;
            }

            return null;
        };
    }