I have a very big PHP class called "Player".
There is a lot of functions inside it(almost 2000 lines). Actually, I use those functions in this way :
$player = new Player(1)
echo $player->getLogin();
echo $player->getStatisticPerception();
echo $player->getWeaponId();
echo $player->attackPlayerId(3,$player->getWeaponId());
I think it could be a good idea to divide this class into multiples classes, but I don't know how. How could I create something like, for example :
$player = new Player(1);
echo $player->getLogin();
echo $player->statistics->getAttack();
echo $player->stuff->getWeaponId();
echo $player->doAction->attackPlayerId(3, $player->getWeaponId());
If think I have to create an object inside this object, but if I do so, i can't access the main "$player"'s object data (for example, in the Stuff Object, I can't access on the $level variable of the Player Object.)
you can create multiple clases like
PlayerStatistics
,Weapon
andPlayerActions
and link them to the Player Class... an example:something like that... it's an object composition or aggregation, depending on the relation between objects.
Hope this helps