<commit_before><?php

/*
 * This file is part of the pinepain/php-weak PHP extension.
 *
 * Copyright (c) 2016 <NAME> <<EMAIL>>
 *
 * Licensed under the MIT license: http://opensource.org/licenses/MIT
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code or visit http://opensource.org/licenses/MIT
 */

namespace Weak;

class Reference
{
    /**
     * @param object        $referent Referent object
     * @param callable|null $notify   Callback to notify when referent object destroyed.
     *
     * Callback will receive current Weak\Reference object as a first argument. Note, that referent object at that time
     * will be already destroyed.
     */
    public function __construct(object $referent, callable $notify = null)
    {
    }

    /**
     * Get referent object
     *
     * @return object | null
     */
    public function get()
    {
    }

    /**
     * Whether referent object exists
     *
     * @return bool
     */
    public function valid() : bool
    {
    }
}<commit_msg>Add array notifier and ability to change existent notifier<commit_after><?php

/*
 * This file is part of the pinepain/php-weak PHP extension.
 *
 * Copyright (c) 2016 <NAME> <<EMAIL>>
 *
 * Licensed under the MIT license: http://opensource.org/licenses/MIT
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code or visit http://opensource.org/licenses/MIT
 */

namespace Weak;

class Reference
{
    /**
     * @param object                  $referent Referent object
     * @param callable | array | null $notify   Optional notifier to signal when referent object destroyed.
     *
     * If notifier is callback, it will be called with a current Weak\Reference object as a first argument. Note, that
     * referent object at that time will be already destroyed. Callback will not be called if referent object destructor
     * or previous notify callback throws exception.
     *
     * If notifier is array, current Weak\Reference object will be appended to it regardless any exception thrown by
     * referent object destructor or previous notify callback.
     */
    public function __construct(object $referent, $notify = null)
    {
    }

    /**
     * Get referent object
     *
     * @return object | null
     */
    public function get()
    {
    }

    /**
     * Whether referent object exists
     *
     * @return bool
     */
    public function valid() : bool
    {
    }

    /**
     * Get notifier
     *
     * @param callable | array | null $notify Notifier to replace existent notifier with. Same as in constructor.
     *
     * If any value provided, any existent notifier will be replaced and returned.
     *
     * @return callable | array | null Current notifier or the old one when replacing it with provided value.
     */
    public function notifier($notify = null)
    {
    }
}
{'fraction_non_alphanumeric': 0.08134453781512604, 'fraction_numerical': 0.002689075630252101, 'mean_word_length': 2.509433962264151, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '1831330', 'n_tokens_mistral': 803, 'n_tokens_neox': 780, 'n_words': 323}