/** * Adds parameters to a new property for vCard 3.0 * * @param Property $newProperty * @param array $parameters * @return void */ protected function convertParameters30(Property $newProperty, array $parameters) { // Adding all parameters. foreach ($parameters as $param) { // vCard 2.1 allowed parameters with no name if ($param->noName) { $param->noName = false; } switch ($param->name) { case 'ENCODING': // This value only existed in vCard 2.1, and should be // removed for anything else. if (strtoupper($param->getValue()) !== 'QUOTED-PRINTABLE') { $newProperty->add($param->name, $param->getParts()); } break; /* * Converting PREF=1 to TYPE=PREF. * * Any other PREF numbers we'll drop. */ /* * Converting PREF=1 to TYPE=PREF. * * Any other PREF numbers we'll drop. */ case 'PREF': if ($param->getValue() == '1') { $newProperty->add('TYPE', 'PREF'); } break; default: $newProperty->add($param->name, $param->getParts()); break; } } }
/** * @expectedException InvalidArgumentException */ function testAddArgFail3() { $property = new Property('EMAIL', 'value'); $property->add('hello', array()); }