Skip to content
Snippets Groups Projects
Select Git revision
  • ba3d252f441717e28f82e9f8c3c265bb541d0622
  • main default protected
  • v0.10
  • 0.10.6
  • 0.10.5
  • 0.10.4
  • 0.10.3
  • 0.10.2
  • 0.10.1
  • 0.10.0
  • 0.9.1
  • 0.9.0
12 results

StoppableBinder.php

Blame
    • Bartek Jaskulski's avatar
      e4b6d594
      fix: improve the work of stoppable binder · e4b6d594
      Bartek Jaskulski authored
      
      Previously stoppable binder was working for all binders, although it
      only supported to signal stop execution with class-based binders. This
      changes the behavior, as having all binders wrapped in stoppable binder
      resulted in execution of all collection binders, without regard for the
      stop signal.
      
      This is convoluted and gets even worse, so this part of the API should
      be rewritten. The side effect of this change is that any callable based
      binder (e.g. database migrations) will not be stopped, no matter what
      happens. This is a serious quirk, and may be better to remove other
      kinds of binders than hookable or rethink the stoppable binder.
      
      Signed-off-by: default avatarBart Jaskulski <bjaskulski@protonmail.com>
      Verified
      e4b6d594
      History
      fix: improve the work of stoppable binder
      Bartek Jaskulski authored
      
      Previously stoppable binder was working for all binders, although it
      only supported to signal stop execution with class-based binders. This
      changes the behavior, as having all binders wrapped in stoppable binder
      resulted in execution of all collection binders, without regard for the
      stop signal.
      
      This is convoluted and gets even worse, so this part of the API should
      be rewritten. The side effect of this change is that any callable based
      binder (e.g. database migrations) will not be stopped, no matter what
      happens. This is a serious quirk, and may be better to remove other
      kinds of binders than hookable or rethink the stoppable binder.
      
      Signed-off-by: default avatarBart Jaskulski <bjaskulski@protonmail.com>
    ConstantNotDefinedStrategy.php 329 B
    <?php
    
    namespace WPDesk\ShowDecision;
    
    class ConstantNotDefinedStrategy implements ShouldShowStrategy
    {
    
    	/**
    	 * @var string
    	 */
    	private string $constant;
    
    	public function __construct(string $constant)
    	{
    		$this->constant = $constant;
    	}
    
    	public function shouldDisplay(): bool
    	{
    		return ! defined($this->constant);
    	}
    
    }