HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/shootinschool/wp-content/plugins/wp-mail-logging/src/WPML_DI_Container.php
<?php

namespace No3x\WPML;
use No3x\WPML\Pimple\Container;

use \ReflectionClass;

class WPML_DI_Container extends Container {

    public function addActionsAndFilters() {
        foreach ($this->keys() as $key) {
            $content = $this[$key];
            if (is_object($content)) {
                $reflection = new ReflectionClass($content);
                if( $this->hasMethod($reflection) ) {
                    if( !$this->implementsInterface($reflection) ) {
                        $this->log($content);
                    }
                    /** @var $content IHooks */
                    $content->addActionsAndFilters();
                }
            }
        }
    }

    private function implementsInterface(ReflectionClass $reflection) {
        return ($reflection->implementsInterface('No3x\WPML\IHooks'));
    }

    private function hasMethod(ReflectionClass $reflection) {
        return ($reflection->hasMethod('addActionsAndFilters'));
    }

    private function log($object) {
        $class_name = get_class($object);
        error_log("{$class_name} doesn't implement the IHook Interface but it seems like it should. Did you forget to add the implements statement?");
    }
}