Remove data/map.json and create data/tokens/<slug> while a slug is a normalized hackerspace name which means all non-alphanumeric characters are replaced by underscores. Multiple underscores are reduced to a single one. Use \Application\Utils\Utils::normalize() for this.
The file content should consist of the token and nothing else. Use Memcached to keep the tokens in memory instead of reading them from the file again and again. The tokens will be frequently used when data are pushed. See this
Drop the classes SpaceMap and SpaceMapList and don't call anything SpaceMap any longer. Create a new class Token with the following methods instead:
public Token::__construct($filepath) // constructor extracts the slug from $filepath, file content = token
public Token::getSlug() : string
public Token::getToken() : string
public Token::getFilePath() : string
public static Token::create($slug, $token, $tokenFilePath) : Token // creates new token file and returns the instance
The token filepath shoudl be in the global application configuration and used in the service where the list of Token instances are created.
Rename file (and including class) from module/Application/src/Application/Service/SpaceMapListFactory.php to module/Application/src/Application/Service/TokenListFactory.php which creates an ArrayCollection containing Token instances.
Remove
data/map.json
and createdata/tokens/<slug>
while a slug is a normalized hackerspace name which means all non-alphanumeric characters are replaced by underscores. Multiple underscores are reduced to a single one. Use\Application\Utils\Utils::normalize()
for this.The file content should consist of the token and nothing else. Use Memcached to keep the tokens in memory instead of reading them from the file again and again. The tokens will be frequently used when data are pushed. See this
To be changed
File: module/Application/src/Application/Service/SpaceMapListFactory.php File: module/Application/src/Application/Map/SpaceMap.php File: module/Application/src/Application/Map/SpaceMapList.php File: module/Application/src/Application/Service/SpaceMapListFactory.php
File: module/Application/src/Application/Controller/EndpointController.php Method: saveSpaceMap()
Drop the classes SpaceMap and SpaceMapList and don't call anything SpaceMap any longer. Create a new class
Token
with the following methods instead:The token filepath shoudl be in the global application configuration and used in the service where the list of
Token
instances are created.Rename file (and including class) from
module/Application/src/Application/Service/SpaceMapListFactory.php
tomodule/Application/src/Application/Service/TokenListFactory.php
which creates an ArrayCollection containing Token instances.