Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 final class FormToArgumentsConverter extends StaticFactory
00013 {
00014 public static function getShort(Form $form)
00015 {
00016 $short = null;
00017
00018 foreach ($form->getPrimitiveList() as $primitive)
00019 if (strlen($primitive->getName()) == 1)
00020 $short .=
00021 $primitive->getName()
00022 .self::getValueType($primitive);
00023
00024 return $short;
00025 }
00026
00027 public static function getLong(Form $form)
00028 {
00029 $long = array();
00030
00031 foreach ($form->getPrimitiveList() as $primitive)
00032 if (strlen($primitive->getName()) > 1)
00033 $long[] =
00034 $primitive->getName()
00035 .self::getValueType($primitive);
00036
00037 return $long;
00038 }
00039
00040 private static function getValueType(BasePrimitive $primitive)
00041 {
00042 if ($primitive instanceof PrimitiveNoValue)
00043 return null;
00044
00045 if ($primitive->isRequired())
00046 return ':';
00047 else
00048 return '::';
00049 }
00050 }
00051 ?>