MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / safeAttributes

Method safeAttributes

benches/fixtures/yii/Model.php:792–807  ·  view source on GitHub ↗

* Returns the attribute names that are safe to be massively assigned in the current scenario. * @return string[] safe attribute names */

()

Source from the content-addressed store, hash-verified

790 * @return string[] safe attribute names
791 */
792 public function safeAttributes()
793 {
794 $scenario = $this->getScenario();
795 $scenarios = $this->scenarios();
796 if (!isset($scenarios[$scenario])) {
797 return [];
798 }
799 $attributes = [];
800 foreach ($scenarios[$scenario] as $attribute) {
801 if (strncmp($attribute, '!', 1) !== 0 && !in_array('!' . $attribute, $scenarios[$scenario])) {
802 $attributes[] = $attribute;
803 }
804 }
805
806 return $attributes;
807 }
808
809 /**
810 * Returns the attribute names that are subject to validation in the current scenario.

Callers 2

isAttributeSafeMethod · 0.95
setAttributesMethod · 0.95

Calls 2

getScenarioMethod · 0.95
scenariosMethod · 0.95

Tested by

no test coverage detected