123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <?php
- /*
- * Copyright 2011 Johannes M. Schmitt <schmittjoh@gmail.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- namespace JMS\SerializerBundle\Serializer;
- use JMS\SerializerBundle\Metadata\ClassMetadata;
- use JMS\SerializerBundle\Metadata\PropertyMetadata;
- /**
- * Interface for visitors.
- *
- * This contains the minimal set of values that must be supported for any
- * output format.
- *
- * @author Johannes M. Schmitt <schmittjoh@gmail.com>
- */
- interface VisitorInterface
- {
- /**
- * Allows visitors to convert the input data to a different representation
- * before the actual serialization/deserialization process starts.
- *
- * @param mixed $data
- *
- * @return mixed
- */
- function prepare($data);
- /**
- * Controls whether keys will be preserved when serializing null values
- *
- * @param bool $serializeNull
- */
- public function setSerializeNull($serializeNull);
- /**
- * @param mixed $data
- * @param array $type
- *
- * @return mixed
- */
- function visitNull($data, array $type);
- /**
- * @param mixed $data
- * @param array $type
- *
- * @return mixed
- */
- function visitString($data, array $type);
- /**
- * @param mixed $data
- * @param array $type
- *
- * @return mixed
- */
- function visitBoolean($data, array $type);
- /**
- * @param mixed $data
- * @param array $type
- *
- * @return mixed
- */
- function visitDouble($data, array $type);
- /**
- * @param mixed $data
- * @param array $type
- *
- * @return mixed
- */
- function visitInteger($data, array $type);
- /**
- * @param mixed $data
- * @param array $type
- *
- * @return mixed
- */
- function visitArray($data, array $type);
- /**
- * Called before the properties of the object are being visited.
- *
- * @param ClassMetadata $metadata
- * @param mixed $data
- * @param array $type
- *
- * @return void
- */
- function startVisitingObject(ClassMetadata $metadata, $data, array $type);
- /**
- * @param PropertyMetadata $metadata
- * @param mixed $data
- *
- * @return void
- */
- function visitProperty(PropertyMetadata $metadata, $data);
- /**
- * Called after all properties of the object have been visited.
- *
- * @param ClassMetadata $metadata
- * @param mixed $data
- * @param array $type
- *
- * @return mixed
- */
- function endVisitingObject(ClassMetadata $metadata, $data, array $type);
- /**
- * Called before serialization/deserialization starts.
- *
- * @param GraphNavigator $navigator
- *
- * @return void
- */
- function setNavigator(GraphNavigator $navigator);
- /**
- * @return GraphNavigator
- */
- function getNavigator();
- /**
- * @return object|array|scalar
- */
- function getResult();
- }
|