コード例 #1
0
 /**
  * Parse an assignment.
  *
  * @param AssignmentInterface $assignment
  * @param                     $string
  */
 protected function parseAssignment(AssignmentInterface $assignment, &$string)
 {
     $string .= "\n[";
     foreach ($assignment->getAttributes() as $key => $value) {
         $value = $assignment->getAttribute($key);
         if (is_string($value)) {
             $value = addslashes($value);
         }
         if (is_array($value)) {
             $value = serialize($value);
         }
         $string .= "\n'{$key}' => '{$value}',";
     }
     // Parse this assignment field.
     $this->parseField($assignment->getField(), $string);
     // Parse assignment translations.
     $this->parseTranslations($assignment, $string);
     $string .= "\n],";
 }