A super easy PHP Framework for web development!
				https://github.com/exacti/phacil-framework
			
			
		
			You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							49 lines
						
					
					
						
							1.1 KiB
						
					
					
				
			
		
		
	
	
							49 lines
						
					
					
						
							1.1 KiB
						
					
					
				<?php
 | 
						|
/**
 | 
						|
 * Copyright © 2023 ExacTI Technology Solutions. All rights reserved.
 | 
						|
 * GPLv3 General License.
 | 
						|
 * https://exacti.com.br
 | 
						|
 * Phacil PHP Framework - https://github.com/exacti/phacil-framework
 | 
						|
 */
 | 
						|
 | 
						|
namespace Phacil\Framework\MagiQL\Builder\Syntax;
 | 
						|
 | 
						|
use \Phacil\Framework\MagiQL\Api\BuilderInterface;
 | 
						|
use Phacil\Framework\MagiQL\Api\Syntax\QueryPartInterface;
 | 
						|
 | 
						|
/**
 | 
						|
 * Class AbstractSetWriter.
 | 
						|
 */
 | 
						|
abstract class AbstractSetWriter
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * @var BuilderInterface
 | 
						|
     */
 | 
						|
    protected $writer;
 | 
						|
 | 
						|
    /**
 | 
						|
     * @param \Phacil\Framework\MagiQL\Api\BuilderInterface $writer
 | 
						|
     */
 | 
						|
    public function __construct(BuilderInterface $writer)
 | 
						|
    {
 | 
						|
        $this->writer = $writer;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * @param QueryPartInterface $setClass
 | 
						|
     * @param string             $setOperation
 | 
						|
     * @param $glue
 | 
						|
     *
 | 
						|
     * @return string
 | 
						|
     */
 | 
						|
    protected function abstractWrite(QueryPartInterface $setClass, $setOperation, $glue)
 | 
						|
    {
 | 
						|
        $selects = [];
 | 
						|
 | 
						|
        foreach ($setClass->$setOperation() as $select) {
 | 
						|
            $selects[] = $this->writer->write($select, false);
 | 
						|
        }
 | 
						|
 | 
						|
        return \implode("\n".$glue."\n", $selects);
 | 
						|
    }
 | 
						|
}
 | 
						|
 |