Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Style/Protection.php
public function applyFromArray(array $pStyles)
    {
        if ($this->isSupervisor) {
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
        } else {
            if (isset($pStyles['locked'])) {
                $this->setLocked($pStyles['locked']);
            }
            if (isset($pStyles['hidden'])) {
                $this->setHidden($pStyles['hidden']);
            }
        }

        return $this;
    }
public function applyFromArray(array $pStyles)
    {
        if ($this->isSupervisor) {
            $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
        } else {
            if (isset($pStyles['locked'])) {
                $this->setLocked($pStyles['locked']);
            }
            if (isset($pStyles['hidden'])) {
                $this->setHidden($pStyles['hidden']);
            }
        }

        return $this;
    }
public function applyFromArray ( array $ pStyles ) { if ( $ this -> isSupervisor ) { $ this -> getActiveSheet ( ) -> getStyle ( $ this -> getSelectedCells ( ) ) -> applyFromArray ( $ this -> getStyleArray ( $ pStyles ) ) ; } else { if ( isset ( $ pStyles [ 'locked' ] ) ) { $ this -> setLocked ( $ pStyles [ 'locked' ] ) ; } if ( isset ( $ pStyles [ 'hidden' ] ) ) { $ this -> setHidden ( $ pStyles [ 'hidden' ] ) ; } } return $ this ; }
Apply styles from array.

<code>
$spreadsheet->getActiveSheet()->getStyle('B2')->getLocked()->applyFromArray(
[
'locked' => TRUE,
'hidden' => FALSE
]
);
</code>

@param array $pStyles Array containing style information

@throws PhpSpreadsheetException

@return Protection
Apply styles from array .