user = $out->getUser(); $this->skin = $out->getSkin(); $this->action = $out->getContext()->getActionName(); $this->namespace = $out->getTitle()->getNamespace(); $this->categories = $out->getCategories(); $this->contentModel = $out->getTitle()->getContentModel(); $this->withGadgetParam = $out->getRequest()->getRawVal( 'withgadget' ); } public function check( Gadget $gadget ): bool { $urlLoad = $this->withGadgetParam === $gadget->getName() && $gadget->supportsUrlLoad(); return ( $gadget->isEnabled( $this->user ) || $urlLoad ) && $gadget->isAllowed( $this->user ) && $gadget->isActionSupported( $this->action ) && $gadget->isSkinSupported( $this->skin ) && $gadget->isNamespaceSupported( $this->namespace ) && $gadget->isCategorySupported( $this->categories ) && $gadget->isContentModelSupported( $this->contentModel ); } }