protected function guardAgainstImpossibleMove()
	{
		if ( !$this->model->exists )
			throw new MoveNotPossibleException( 'A new node cannot be moved.' );

		if ( array_search( $this->position, ['child', 'left', 'right', 'root'] ) === false )
			throw new MoveNotPossibleException( "Position should be one of ['child', 'left', 'right'] but is {$this->position}." );

		if ( !$this->promotingToRoot() )
		{
			if ( is_null( $this->target ) )
			{
				if ( $this->position === 'left' || $this->position === 'right' )
					throw new MoveNotPossibleException( "Could not resolve target node. This node cannot move any further to the {$this->position}." );
				else
					throw new MoveNotPossibleException( 'Could not resolve target node.' );
			}

			if ( $this->model->equals( $this->target ) )
				throw new MoveNotPossibleException( 'A node cannot be moved to itself.' );

			if ( $this->target->insideSubtree( $this->model ) )
				throw new MoveNotPossibleException( 'A node cannot be moved to a descendant of itself (inside moved tree).' );

			if ( !$this->model->inSameScope( $this->target ) )
				throw new MoveNotPossibleException( 'A node cannot be moved to a different scope.' );
		}
	}
protected function guardAgainstImpossibleMove()
	{
		if ( !$this->model->exists )
			throw new MoveNotPossibleException( 'A new node cannot be moved.' );

		if ( array_search( $this->position, ['child', 'left', 'right', 'root'] ) === false )
			throw new MoveNotPossibleException( "Position should be one of ['child', 'left', 'right'] but is {$this->position}." );

		if ( !$this->promotingToRoot() )
		{
			if ( is_null( $this->target ) )
			{
				if ( $this->position === 'left' || $this->position === 'right' )
					throw new MoveNotPossibleException( "Could not resolve target node. This node cannot move any further to the {$this->position}." );
				else
					throw new MoveNotPossibleException( 'Could not resolve target node.' );
			}

			if ( $this->model->equals( $this->target ) )
				throw new MoveNotPossibleException( 'A node cannot be moved to itself.' );

			if ( $this->target->insideSubtree( $this->model ) )
				throw new MoveNotPossibleException( 'A node cannot be moved to a descendant of itself (inside moved tree).' );

			if ( !$this->model->inSameScope( $this->target ) )
				throw new MoveNotPossibleException( 'A node cannot be moved to a different scope.' );
		}
	}
protected function guardAgainstImpossibleMove ( ) { if ( ! $ this -> model -> exists ) throw new MoveNotPossibleException ( 'A new node cannot be moved.' ) ; if ( array_search ( $ this -> position , [ 'child' , 'left' , 'right' , 'root' ] ) === false ) throw new MoveNotPossibleException ( "Position should be one of ['child', 'left', 'right'] but is {$this->position}." ) ; if ( ! $ this -> promotingToRoot ( ) ) { if ( is_null ( $ this -> target ) ) { if ( $ this -> position === 'left' || $ this -> position === 'right' ) throw new MoveNotPossibleException ( "Could not resolve target node. This node cannot move any further to the {$this->position}." ) ; else throw new MoveNotPossibleException ( 'Could not resolve target node.' ) ; } if ( $ this -> model -> equals ( $ this -> target ) ) throw new MoveNotPossibleException ( 'A node cannot be moved to itself.' ) ; if ( $ this -> target -> insideSubtree ( $ this -> model ) ) throw new MoveNotPossibleException ( 'A node cannot be moved to a descendant of itself (inside moved tree).' ) ; if ( ! $ this -> model -> inSameScope ( $ this -> target ) ) throw new MoveNotPossibleException ( 'A node cannot be moved to a different scope.' ) ; } }
Check wether the current move is possible and if not, rais an exception.

@return void
Check wether the current move is possible and if not rais an exception .