public function saveListCurrentAcl(): int
    {
        $separate = $last = $this->loadListCurrentAcl();
        foreach ($this->listCurrentAcl as $item) {
            if (!isset($separate[$item['resource']])) {
                $separate[$item['resource']] = [];
            }

            if (!in_array($item['privilege'], $separate[$item['resource']])) {
                $separate[$item['resource']][] = $item['privilege'];
            }
        }
        // save only detect change
        if ($separate != $last) {
            return (int) file_put_contents($this->getPathListCurrentAcl(), Neon::encode($separate, Neon::BLOCK));
        }
        return 0;
    }
public function saveListCurrentAcl(): int
    {
        $separate = $last = $this->loadListCurrentAcl();
        foreach ($this->listCurrentAcl as $item) {
            if (!isset($separate[$item['resource']])) {
                $separate[$item['resource']] = [];
            }

            if (!in_array($item['privilege'], $separate[$item['resource']])) {
                $separate[$item['resource']][] = $item['privilege'];
            }
        }
        // save only detect change
        if ($separate != $last) {
            return (int) file_put_contents($this->getPathListCurrentAcl(), Neon::encode($separate, Neon::BLOCK));
        }
        return 0;
    }
public function saveListCurrentAcl ( ) : int { $ separate = $ last = $ this -> loadListCurrentAcl ( ) ; foreach ( $ this -> listCurrentAcl as $ item ) { if ( ! isset ( $ separate [ $ item [ 'resource' ] ] ) ) { $ separate [ $ item [ 'resource' ] ] = [ ] ; } if ( ! in_array ( $ item [ 'privilege' ] , $ separate [ $ item [ 'resource' ] ] ) ) { $ separate [ $ item [ 'resource' ] ] [ ] = $ item [ 'privilege' ] ; } } // save only detect change if ( $ separate != $ last ) { return ( int ) file_put_contents ( $ this -> getPathListCurrentAcl ( ) , Neon :: encode ( $ separate , Neon :: BLOCK ) ) ; } return 0 ; }
Save list current acl.

@return int
Save list current acl .