<commit_before><?php

namespace Encore\Foundation;

abstract class Facade
{
    protected static $app;
    protected static $resolved;

    public static function getFacade()
    {
        throw new \RuntimeException('Facade does not implement getFacade method');
    }

    public static function resolveFacade($name)
    {
        if (is_object($name)) return $name;

        if (isset(static::$resolved[$name])) return static::$resolved[$name];

        return static::$resolved[$name] = static::$app[$name];<commit_msg>Correctly resolving a closure based binding in facades<commit_after><?php

namespace Encore\Foundation;

abstract class Facade
{
    protected static $app;
    protected static $resolved;

    public static function getFacade()
    {
        throw new \RuntimeException('Facade does not implement getFacade method');
    }

    public static function resolveFacade($name)
    {
        if (is_object($name)) return $name;

        if (isset(static::$resolved[$name])) return static::$resolved[$name];

        if (static::$app[$name] instanceof \Closure) {
            $closure = static::$app[$name];
            return static::$resolved[$name] = $closure();
        }

        return static::$resolved[$name] = static::$app[$name];
{'fraction_non_alphanumeric': 0.12669322709163347, 'fraction_numerical': 0.0, 'mean_word_length': 3.407017543859649, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2865157', 'n_tokens_mistral': 335, 'n_tokens_neox': 335, 'n_words': 93}